From 68b944e6e62fa69669e97a8c2041a7eb7ed3314a Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Fri, 10 Feb 2023 15:20:19 +0100 Subject: [PATCH] Preserve order of securitySchemes (#14536) * Remove alphabetical sort * Update integration testing expectations * Regenerate files --- .../openapitools/codegen/DefaultCodegen.java | 8 - .../codegen/DefaultCodegenTest.java | 14 + .../petstore-expected/configuration.ts | 18 +- .../client/petstore/R-httr2-wrapper/README.md | 20 +- samples/client/petstore/R-httr2/README.md | 20 +- samples/client/petstore/R/README.md | 20 +- samples/client/petstore/apex/README.md | 14 +- samples/client/petstore/bash/README.md | 20 +- samples/client/petstore/bash/petstore-cli | 12 +- samples/client/petstore/c/README.md | 16 +- samples/client/petstore/c/include/apiClient.h | 2 +- samples/client/petstore/c/src/apiClient.c | 10 +- samples/client/petstore/cpp-qt/README.md | 14 +- .../crystal/src/petstore/configuration.cr | 12 +- .../README.md | 30 +- .../docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../docs/apis/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 48 +- .../src/Org.OpenAPITools/README.md | 34 +- .../docs/apis/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 48 +- .../src/Org.OpenAPITools/README.md | 34 +- .../docs/apis/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 48 +- .../src/Org.OpenAPITools/README.md | 34 +- .../OpenAPIClient-httpclient/README.md | 30 +- .../OpenAPIClient-httpclient/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 96 +-- .../OpenAPIClient-net47/README.md | 30 +- .../OpenAPIClient-net47/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../OpenAPIClient-net48/README.md | 30 +- .../OpenAPIClient-net48/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../OpenAPIClient-net5.0/README.md | 30 +- .../OpenAPIClient-net5.0/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../csharp-netcore/OpenAPIClient/README.md | 30 +- .../OpenAPIClient/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../OpenAPIClientCore/README.md | 30 +- .../OpenAPIClientCore/docs/PetApi.md | 8 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 256 +++--- .../OpenAPIClientCoreAndNet47/README.md | 14 +- .../petstore/csharp/OpenAPIClient/README.md | 34 +- .../client/petstore/go/go-petstore/README.md | 60 +- .../lib/OpenAPIPetstore/Model.hs | 26 +- .../java-micronaut-client/docs/apis/auth.md | 20 +- .../petstore/java/apache-httpclient/README.md | 24 +- .../org/openapitools/client/ApiClient.java | 4 +- .../org/openapitools/client/ApiClient.java | 6 +- .../org/openapitools/client/ApiClient.java | 10 +- .../petstore/java/google-api-client/README.md | 20 +- .../client/petstore/java/jersey1/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 2 +- .../jersey2-java8-localdatetime/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 16 +- .../petstore/java/jersey2-java8/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 16 +- .../client/petstore/java/jersey3/README.md | 24 +- .../petstore/java/jersey3/docs/PetApi.md | 16 +- .../org/openapitools/client/ApiClient.java | 32 +- .../org/openapitools/client/api/PetApi.java | 8 +- .../petstore/java/native-async/README.md | 24 +- .../petstore/java/native-async/docs/PetApi.md | 32 +- .../petstore/java/native-jakarta/README.md | 14 +- samples/client/petstore/java/native/README.md | 24 +- .../petstore/java/native/docs/PetApi.md | 32 +- .../java/okhttp-gson-awsv4signature/README.md | 12 +- .../org/openapitools/client/ApiClient.java | 4 +- .../okhttp-gson-dynamicOperations/README.md | 18 +- .../org/openapitools/client/ApiClient.java | 4 +- .../okhttp-gson-group-parameter/README.md | 12 +- .../org/openapitools/client/ApiClient.java | 4 +- .../okhttp-gson-parcelableModel/README.md | 18 +- .../org/openapitools/client/ApiClient.java | 4 +- .../java/okhttp-gson-swagger1/README.md | 12 +- .../org/openapitools/client/ApiClient.java | 4 +- .../petstore/java/okhttp-gson/README.md | 22 +- .../petstore/java/okhttp-gson/docs/PetApi.md | 16 +- .../org/openapitools/client/ApiClient.java | 10 +- .../org/openapitools/client/api/PetApi.java | 8 +- .../client/petstore/java/resteasy/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 2 +- .../java/resttemplate-jakarta/README.md | 14 +- .../org/openapitools/client/ApiClient.java | 2 +- .../java/resttemplate-swagger1/README.md | 14 +- .../org/openapitools/client/ApiClient.java | 2 +- .../java/resttemplate-withXml/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 2 +- .../petstore/java/resttemplate/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 2 +- .../org/openapitools/client/ApiClient.java | 2 +- .../org/openapitools/client/ApiClient.java | 8 +- .../org/openapitools/client/ApiClient.java | 8 +- .../org/openapitools/client/ApiClient.java | 8 +- .../petstore/java/vertx-no-nullable/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 22 +- samples/client/petstore/java/vertx/README.md | 20 +- .../org/openapitools/client/ApiClient.java | 22 +- .../petstore/java/webclient-jakarta/README.md | 24 +- .../org/openapitools/client/ApiClient.java | 4 +- .../client/petstore/java/webclient/README.md | 24 +- .../org/openapitools/client/ApiClient.java | 4 +- .../petstore/javascript-apollo/README.md | 36 +- .../javascript-apollo/src/ApiClient.js | 4 +- .../client/petstore/javascript-es6/README.md | 36 +- .../petstore/javascript-es6/src/ApiClient.js | 4 +- .../petstore/javascript-promise-es6/README.md | 36 +- .../javascript-promise-es6/src/ApiClient.js | 4 +- samples/client/petstore/kotlin-gson/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../client/petstore/kotlin-jackson/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../kotlin-json-request-string/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../petstore/kotlin-jvm-ktor-gson/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 4 +- .../kotlin-jvm-ktor-jackson/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 4 +- .../kotlin-jvm-okhttp4-coroutines/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../petstore/kotlin-jvm-vertx-gson/README.md | 14 +- .../README.md | 14 +- .../kotlin-jvm-vertx-jackson/README.md | 14 +- .../petstore/kotlin-jvm-vertx-moshi/README.md | 14 +- .../petstore/kotlin-jvm-volley/README.md | 14 +- .../client/request/RequestFactory.kt | 2 +- .../petstore/kotlin-modelMutable/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../petstore/kotlin-moshi-codegen/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../petstore/kotlin-multiplatform/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 4 +- .../petstore/kotlin-nonpublic/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../client/petstore/kotlin-nullable/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../client/petstore/kotlin-okhttp3/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../README.md | 14 +- .../client/infrastructure/ApiClient.kt | 2 +- .../petstore/kotlin-retrofit2-rx3/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 2 +- .../petstore/kotlin-retrofit2/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 2 +- .../client/petstore/kotlin-string/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../petstore/kotlin-threetenbp/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- samples/client/petstore/kotlin/README.md | 14 +- .../client/infrastructure/ApiClient.kt | 10 +- .../core-data/SwaggerClient/Api/SWGPetApi.m | 2 +- .../petstore/objc/core-data/docs/SWGPetApi.md | 8 +- .../default/SwaggerClient/Api/SWGPetApi.m | 2 +- .../petstore/objc/default/docs/SWGPetApi.md | 8 +- samples/client/petstore/perl/README.md | 22 +- .../perl/lib/WWW/OpenAPIClient/ApiClient.pm | 20 +- .../petstore/php/OpenAPIClient-php/README.md | 30 +- samples/client/petstore/powershell/README.md | 26 +- .../petstore/powershell/docs/PSPetApi.md | 32 +- .../client/petstore/python-asyncio/README.md | 20 +- .../petstore_api/configuration.py | 14 +- .../client/petstore/python-legacy/README.md | 20 +- .../petstore_api/configuration.py | 14 +- .../client/petstore/python-prior/README.md | 20 +- .../petstore_api/configuration.py | 14 +- .../README.md | 20 +- .../petstore_api/configuration.py | 14 +- .../client/petstore/python-tornado/README.md | 20 +- .../petstore_api/configuration.py | 14 +- .../client/petstore/ruby-autoload/README.md | 28 +- .../lib/petstore/configuration.rb | 20 +- .../client/petstore/ruby-faraday/README.md | 28 +- .../lib/petstore/configuration.rb | 20 +- samples/client/petstore/ruby/README.md | 28 +- .../ruby/lib/petstore/configuration.rb | 20 +- .../configuration/ClientConfiguration.java | 18 +- .../configuration/ClientConfiguration.java | 18 +- .../configuration/ClientConfiguration.java | 18 +- .../configuration/ClientConfiguration.java | 18 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../swift5/alamofireLibrary/README.md | 18 +- .../swift5/alamofireLibrary/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../swift5/asyncAwaitLibrary/README.md | 18 +- .../swift5/asyncAwaitLibrary/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/combineLibrary/README.md | 18 +- .../swift5/combineLibrary/docs/PetAPI.md | 2 +- .../client/petstore/swift5/default/README.md | 18 +- .../petstore/swift5/deprecated/README.md | 18 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/frozenEnums/README.md | 18 +- .../swift5/frozenEnums/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/nonPublicApi/README.md | 18 +- .../swift5/nonPublicApi/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/objcCompatible/README.md | 18 +- .../swift5/objcCompatible/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../swift5/promisekitLibrary/README.md | 18 +- .../swift5/promisekitLibrary/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../swift5/readonlyProperties/README.md | 18 +- .../swift5/readonlyProperties/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/resultLibrary/README.md | 18 +- .../swift5/resultLibrary/docs/PetAPI.md | 2 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../petstore/swift5/rxswiftLibrary/README.md | 18 +- .../swift5/rxswiftLibrary/docs/PetAPI.md | 2 +- .../swift5/urlsessionLibrary/README.md | 18 +- .../Sources/PetstoreClient/APIs/PetAPI.swift | 6 +- .../swift5/urlsessionLibrary/docs/PetAPI.md | 2 +- .../petstore/swift5/vaporLibrary/README.md | 18 +- .../Classes/OpenAPIs/APIs/PetAPI.swift | 6 +- .../swift5/x-swift-hashable/README.md | 18 +- .../swift5/x-swift-hashable/docs/PetAPI.md | 2 +- .../builds/default/configuration.ts | 18 +- .../builds/default/configuration.ts | 18 +- .../builds/with-npm/configuration.ts | 18 +- .../builds/default/configuration.ts | 18 +- .../builds/default/configuration.ts | 18 +- .../builds/with-npm/configuration.ts | 18 +- .../builds/default/configuration.ts | 18 +- .../configuration.ts | 18 +- .../builds/default/configuration.ts | 18 +- .../typescript-aurelia/default/AuthStorage.ts | 50 +- .../builds/test-petstore/api.ts | 16 +- .../api.ts | 16 +- .../typescript-node/default/api/petApi.ts | 2 +- .../typescript-node/default/api/storeApi.ts | 2 +- .../typescript-node/default/api/userApi.ts | 2 +- .../typescript-node/npm/api/petApi.ts | 2 +- .../typescript-node/npm/api/storeApi.ts | 2 +- .../typescript-node/npm/api/userApi.ts | 2 +- .../README.md | 22 +- .../petstore_client_lib_fake/README.md | 22 +- .../dart2/petstore_client_lib/README.md | 12 +- .../dart2/petstore_client_lib_fake/README.md | 26 +- .../client/petstore/go/go-petstore/README.md | 84 +- .../petstore/go/go-petstore/docs/PetApi.md | 8 +- .../java/jersey2-java8-swagger1/README.md | 14 +- .../org/openapitools/client/ApiClient.java | 16 +- .../petstore/java/jersey2-java8/README.md | 24 +- .../java/jersey2-java8/docs/PetApi.md | 16 +- .../org/openapitools/client/ApiClient.java | 32 +- .../org/openapitools/client/api/PetApi.java | 8 +- .../client/petstore/python-legacy/README.md | 30 +- .../petstore_api/configuration.py | 28 +- .../petstore/python-nextgen-aiohttp/README.md | 30 +- .../python-nextgen-aiohttp/docs/PetApi.md | 760 +++++++++--------- .../petstore_api/api/pet_api.py | 8 +- .../petstore_api/configuration.py | 28 +- .../client/petstore/python-nextgen/README.md | 30 +- .../petstore/python-nextgen/docs/PetApi.md | 760 +++++++++--------- .../petstore_api/api/pet_api.py | 8 +- .../petstore_api/configuration.py | 28 +- .../client/petstore/python-prior/README.md | 30 +- .../petstore/python-prior/docs/PetApi.md | 56 +- .../python-prior/petstore_api/api/pet_api.py | 16 +- .../petstore_api/configuration.py | 28 +- .../openapi3/client/petstore/python/README.md | 30 +- .../petstore/python/docs/apis/tags/PetApi.md | 56 +- .../python/petstore_api/configuration.py | 28 +- .../python/petstore_api/paths/pet/post.py | 2 +- .../python/petstore_api/paths/pet/put.py | 2 +- .../paths/pet_find_by_status/get.py | 2 +- .../paths/pet_find_by_tags/get.py | 2 +- .../configuration/ClientConfiguration.java | 18 +- .../configuration/ClientConfiguration.java | 18 +- .../typescript/builds/browser/auth/auth.ts | 60 +- .../typescript/builds/default/auth/auth.ts | 60 +- .../typescript/builds/deno/auth/auth.ts | 60 +- .../typescript/builds/inversify/auth/auth.ts | 66 +- .../typescript/builds/jquery/auth/auth.ts | 60 +- .../builds/object_params/auth/auth.ts | 60 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../configuration/SpringDocConfiguration.java | 6 +- .../src/openapi_logic_handler.erl | 1 - .../kotlin-server-modelMutable/README.md | 14 +- .../kotlin/org/openapitools/server/AppMain.kt | 16 +- .../org/openapitools/server/Configuration.kt | 2 +- .../kotlin-server/jaxrs-spec/README.md | 14 +- .../petstore/kotlin-server/ktor/README.md | 14 +- .../kotlin/org/openapitools/server/AppMain.kt | 16 +- .../org/openapitools/server/Configuration.kt | 2 +- .../openapitools/SpringDocConfiguration.kt | 6 +- .../openapitools/SpringDocConfiguration.kt | 6 +- .../kotlin-vertx-modelMutable/README.md | 14 +- .../server/petstore/kotlin/vertx/README.md | 14 +- samples/server/petstore/php-slim4/README.md | 6 +- .../php-symfony/SymfonyBundle-php/README.md | 12 +- .../controllers/security_controller_.py | 20 +- .../controllers/security_controller_.py | 20 +- .../src/openapi_server/security_api.py | 38 +- .../controllers/security_controller_.py | 32 +- .../README.md | 30 +- .../src/context.rs | 22 +- .../configuration/SpringDocConfiguration.java | 6 +- 308 files changed, 4019 insertions(+), 4014 deletions(-) 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 f198bb1c8ae..0d77a20a74d 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 @@ -5303,14 +5303,6 @@ public class DefaultCodegen implements CodegenConfig { } } - // sort auth methods to maintain the same order - Collections.sort(codegenSecurities, new Comparator() { - @Override - public int compare(CodegenSecurity one, CodegenSecurity another) { - return ObjectUtils.compare(one.name, another.name); - } - }); - return codegenSecurities; } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index b571cf2173c..0414e03457b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -2543,6 +2543,20 @@ public class DefaultCodegenTest { assertTrue(flows.containsAll(Arrays.asList("password", "application"))); } + @Test + public void testMultipleSecuritySchemes() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + final Map securitySchemes = openAPI.getComponents().getSecuritySchemes(); + final List securities = codegen.fromSecurity(securitySchemes); + + assertEquals(securities.size(), 2); + assertEquals(securities.get(0).name, "petstore_auth"); + assertEquals(securities.get(1).name, "api_key"); + } + @Test public void testItemsPresent() { final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_7613.yaml"); diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/R-httr2-wrapper/README.md b/samples/client/petstore/R-httr2-wrapper/README.md index 12e7b2a7aac..52a64392dd7 100644 --- a/samples/client/petstore/R-httr2-wrapper/README.md +++ b/samples/client/petstore/R-httr2-wrapper/README.md @@ -134,20 +134,14 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### BearerToken - -- **Type**: Bearer authentication - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### http_auth - **Type**: HTTP basic authentication +### BearerToken + +- **Type**: Bearer authentication + ### petstore_auth - **Type**: OAuth @@ -157,4 +151,10 @@ Class | Method | HTTP request | Description - `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 + diff --git a/samples/client/petstore/R-httr2/README.md b/samples/client/petstore/R-httr2/README.md index 12e7b2a7aac..52a64392dd7 100644 --- a/samples/client/petstore/R-httr2/README.md +++ b/samples/client/petstore/R-httr2/README.md @@ -134,20 +134,14 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### BearerToken - -- **Type**: Bearer authentication - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### http_auth - **Type**: HTTP basic authentication +### BearerToken + +- **Type**: Bearer authentication + ### petstore_auth - **Type**: OAuth @@ -157,4 +151,10 @@ Class | Method | HTTP request | Description - `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 + diff --git a/samples/client/petstore/R/README.md b/samples/client/petstore/R/README.md index 39c03b3133c..dbe87ad6dd3 100644 --- a/samples/client/petstore/R/README.md +++ b/samples/client/petstore/R/README.md @@ -134,20 +134,14 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### BearerToken - -- **Type**: Bearer authentication - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### http_auth - **Type**: HTTP basic authentication +### BearerToken + +- **Type**: Bearer authentication + ### petstore_auth - **Type**: OAuth @@ -157,4 +151,10 @@ Class | Method | HTTP request | Description - `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 + diff --git a/samples/client/petstore/apex/README.md b/samples/client/petstore/apex/README.md index 60da087e3fb..3477df50aaf 100644 --- a/samples/client/petstore/apex/README.md +++ b/samples/client/petstore/apex/README.md @@ -100,13 +100,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -116,6 +109,13 @@ Authentication schemes defined for the API: - 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 + ## Author diff --git a/samples/client/petstore/bash/README.md b/samples/client/petstore/bash/README.md index 43e3a3ea37d..2cd5ff4badd 100644 --- a/samples/client/petstore/bash/README.md +++ b/samples/client/petstore/bash/README.md @@ -200,6 +200,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -218,13 +228,3 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - diff --git a/samples/client/petstore/bash/petstore-cli b/samples/client/petstore/bash/petstore-cli index 5ffeb5205bb..802f75430c0 100755 --- a/samples/client/petstore/bash/petstore-cli +++ b/samples/client/petstore/bash/petstore-cli @@ -742,18 +742,18 @@ ${BOLD}${WHITE}Usage${OFF} EOF echo -e "${BOLD}${WHITE}Authentication methods${OFF}" echo -e "" - echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key:${OFF}' after ${YELLOW}${OFF}" - echo -e " or export ${RED}PETSTORE_API_KEY=''${OFF}" - echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key_query=${OFF}' after ${YELLOW}${OFF}" - echo -e " or export ${RED}PETSTORE_API_KEY=''${OFF}" - echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u :' before ${YELLOW}${OFF}" - echo -e " or export ${RED}PETSTORE_BASIC_AUTH=':'${OFF}" echo -e " - ${MAGENTA}OAuth2 (flow: implicit)${OFF}" echo -e " Authorization URL: " echo -e " * http://petstore.swagger.io/api/oauth/dialog" echo -e " Scopes:" echo -e " * write:pets - modify pets in your account" echo -e " * read:pets - read your pets" + echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key:${OFF}' after ${YELLOW}${OFF}" + echo -e " or export ${RED}PETSTORE_API_KEY=''${OFF}" + echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key_query=${OFF}' after ${YELLOW}${OFF}" + echo -e " or export ${RED}PETSTORE_API_KEY=''${OFF}" + echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u :' before ${YELLOW}${OFF}" + echo -e " or export ${RED}PETSTORE_BASIC_AUTH=':'${OFF}" echo "" echo -e "${BOLD}${WHITE}Operations (grouped by tags)${OFF}" echo "" diff --git a/samples/client/petstore/c/README.md b/samples/client/petstore/c/README.md index 4f6eda38295..5c3d118b22c 100644 --- a/samples/client/petstore/c/README.md +++ b/samples/client/petstore/c/README.md @@ -100,14 +100,6 @@ Category | Method | HTTP request | Description ## Documentation for Authorization -### api_key - -- **Type**: API key - -- **API key parameter name**: api_key -- **Location**: HTTP header - - ### petstore_auth @@ -119,6 +111,14 @@ Category | Method | HTTP request | Description - read:pets: read your pets +### api_key + +- **Type**: API key + +- **API key parameter name**: api_key +- **Location**: HTTP header + + ## Author diff --git a/samples/client/petstore/c/include/apiClient.h b/samples/client/petstore/c/include/apiClient.h index 043397fc91d..914cf9ea9c1 100644 --- a/samples/client/petstore/c/include/apiClient.h +++ b/samples/client/petstore/c/include/apiClient.h @@ -28,8 +28,8 @@ typedef struct apiClient_t { int (*progress_func)(void *, curl_off_t, curl_off_t, curl_off_t, curl_off_t); void *progress_data; long response_code; - list_t *apiKeys_api_key; char *accessToken; + list_t *apiKeys_api_key; } apiClient_t; apiClient_t* apiClient_create(); diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index 097788134a2..89d6301a98d 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -16,8 +16,8 @@ apiClient_t *apiClient_create() { apiClient->progress_func = NULL; apiClient->progress_data = NULL; apiClient->response_code = 0; - apiClient->apiKeys_api_key = NULL; apiClient->accessToken = NULL; + apiClient->apiKeys_api_key = NULL; return apiClient; } @@ -45,6 +45,7 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath apiClient->progress_func = NULL; apiClient->progress_data = NULL; apiClient->response_code = 0; + apiClient->accessToken = NULL; if(apiKeys_api_key!= NULL) { apiClient->apiKeys_api_key = list_createList(); listEntry_t *listEntry = NULL; @@ -56,7 +57,6 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath }else{ apiClient->apiKeys_api_key = NULL; } - apiClient->accessToken = NULL; return apiClient; } @@ -68,6 +68,9 @@ void apiClient_free(apiClient_t *apiClient) { apiClient->data_callback_func = NULL; apiClient->progress_func = NULL; apiClient->progress_data = NULL; + if(apiClient->accessToken) { + free(apiClient->accessToken); + } if(apiClient->apiKeys_api_key) { listEntry_t *listEntry = NULL; list_ForEach(listEntry, apiClient->apiKeys_api_key) { @@ -82,9 +85,6 @@ void apiClient_free(apiClient_t *apiClient) { } list_freeList(apiClient->apiKeys_api_key); } - if(apiClient->accessToken) { - free(apiClient->accessToken); - } free(apiClient); } diff --git a/samples/client/petstore/cpp-qt/README.md b/samples/client/petstore/cpp-qt/README.md index 7700fd41b82..4c2cf2ccc78 100644 --- a/samples/client/petstore/cpp-qt/README.md +++ b/samples/client/petstore/cpp-qt/README.md @@ -128,13 +128,6 @@ servers: ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -145,6 +138,13 @@ Authentication schemes defined for the API: - 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 + ## Author diff --git a/samples/client/petstore/crystal/src/petstore/configuration.cr b/samples/client/petstore/crystal/src/petstore/configuration.cr index eace8387130..e0b201e3905 100644 --- a/samples/client/petstore/crystal/src/petstore/configuration.cr +++ b/samples/client/petstore/crystal/src/petstore/configuration.cr @@ -218,18 +218,18 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings Hash{ - "api_key" => { - type: "api_key", - in: "header", - key: "api_key", - value: api_key_with_prefix(:api_key) - }, "petstore_auth" => { type: "oauth2", in: "header", key: "Authorization", value: "Bearer #{access_token}" }, + "api_key" => { + type: "api_key", + in: "header", + key: "api_key", + value: api_key_with_prefix(:api_key) + }, } end diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md index cf4a21009f8..46d61ab2f54 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/README.md @@ -234,6 +234,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -248,27 +258,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/PetApi.md index 1c51cb3d775..03dec23f686 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs index e8439eb1250..22b4eeeea76 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/PetApi.md index d5e8e8330a0..ddf4b7d9486 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/apis/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index 0e46e92ad02..39af75cf2ae 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -553,6 +553,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -561,12 +567,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" @@ -883,6 +883,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -891,12 +897,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -1056,6 +1056,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -1064,12 +1070,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -1381,6 +1381,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -1389,12 +1395,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/README.md index 6b76b0ef368..e0af5a31ca7 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/README.md @@ -155,6 +155,17 @@ namespace YourProject 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 @@ -169,34 +180,23 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - ## Build - SDK version: 1.0.0 - Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/PetApi.md index da6486e4cdc..b39f8fc403f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/apis/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index 33b932d41a8..c2d4f9e0502 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -445,6 +445,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -453,12 +459,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" @@ -775,6 +775,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -783,12 +789,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -948,6 +948,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -956,12 +962,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -1273,6 +1273,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -1281,12 +1287,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/README.md index e792f496009..814256767c2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/README.md @@ -155,6 +155,17 @@ namespace YourProject 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 @@ -169,34 +180,23 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - ## Build - SDK version: 1.0.0 - Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/PetApi.md index da6486e4cdc..b39f8fc403f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/apis/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index b858b1d8430..6ae46f4b3a4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -445,6 +445,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -453,12 +459,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" @@ -775,6 +775,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -783,12 +789,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -948,6 +948,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -956,12 +962,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] accepts = new string[] { "application/xml", "application/json" @@ -1273,6 +1273,12 @@ namespace Org.OpenAPITools.Api request.RequestUri = uriBuilder.Uri; + OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); + + tokens.Add(oauthToken); + + oauthToken.UseInHeader(request, ""); + HttpSignatureToken signatureToken = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); tokens.Add(signatureToken); @@ -1281,12 +1287,6 @@ namespace Org.OpenAPITools.Api signatureToken.UseInHeader(request, requestBody, cancellationToken); - OAuthToken oauthToken = (OAuthToken) await OauthTokenProvider.GetAsync(cancellationToken).ConfigureAwait(false); - - tokens.Add(oauthToken); - - oauthToken.UseInHeader(request, ""); - string[] contentTypes = new string[] { "application/json", "application/xml" diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/README.md index e5abd8bceaa..481bdaa2999 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/README.md @@ -155,6 +155,17 @@ namespace YourProject 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 @@ -169,34 +180,23 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - ## Build - SDK version: 1.0.0 - Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md index 548538cc7a2..15085d15425 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/README.md @@ -259,6 +259,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -273,27 +283,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/PetApi.md index 9db1797db99..b5817f5b346 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/PetApi.md @@ -91,7 +91,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -283,7 +283,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -382,7 +382,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -577,7 +577,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs index 6f8299aee6c..ff507872436 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/PetApi.cs @@ -701,6 +701,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Data = pet; + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -717,12 +723,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth 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.Post("/pet", localVarRequestOptions, this.Configuration); @@ -782,6 +782,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Data = pet; + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -798,12 +804,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } // make the HTTP request @@ -988,6 +988,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1004,12 +1010,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth 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.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); @@ -1070,6 +1070,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1086,12 +1092,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } // make the HTTP request @@ -1151,6 +1151,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1167,12 +1173,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth 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.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); @@ -1235,6 +1235,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1251,12 +1257,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } // make the HTTP request @@ -1432,6 +1432,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Data = pet; + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1448,12 +1454,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth 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.Put("/pet", localVarRequestOptions, this.Configuration); @@ -1513,6 +1513,12 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Data = pet; + // authentication (petstore_auth) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -1529,12 +1535,6 @@ namespace Org.OpenAPITools.Api } } } - // authentication (petstore_auth) required - // oauth required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } // make the HTTP request diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md index 31c4c4a2ce2..5dae7e02093 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/README.md @@ -246,6 +246,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -260,27 +270,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/PetApi.md index 1c51cb3d775..03dec23f686 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/PetApi.cs index e8439eb1250..22b4eeeea76 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md index 31c4c4a2ce2..5dae7e02093 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/README.md @@ -246,6 +246,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -260,27 +270,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/PetApi.md index 1c51cb3d775..03dec23f686 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Api/PetApi.cs index e8439eb1250..22b4eeeea76 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md index 31c4c4a2ce2..5dae7e02093 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/README.md @@ -246,6 +246,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -260,27 +270,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md index ddb355ff109..50ca6a747ac 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs index 74e6a8eef77..cb1a5d8b24d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index cf4a21009f8..46d61ab2f54 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -234,6 +234,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -248,27 +258,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md index 1c51cb3d775..03dec23f686 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs index e8439eb1250..22b4eeeea76 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index 31c4c4a2ce2..5dae7e02093 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -246,6 +246,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization + +### 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 @@ -260,27 +270,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string - -### bearer_test - -- **Type**: Bearer Authentication - ### http_basic_test - **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: Bearer Authentication + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md index 1c51cb3d775..03dec23f686 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md @@ -87,7 +87,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -271,7 +271,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -366,7 +366,7 @@ catch (ApiException e) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -553,7 +553,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs index e8439eb1250..22b4eeeea76 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Api/PetApi.cs @@ -657,22 +657,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -689,6 +673,22 @@ namespace Org.OpenAPITools.Api 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); @@ -762,22 +762,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.AddPet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -794,6 +778,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1038,22 +1038,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1070,6 +1054,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1144,22 +1144,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1176,6 +1160,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1250,22 +1250,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1282,6 +1266,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1358,22 +1358,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1390,6 +1374,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1605,22 +1605,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1637,6 +1621,22 @@ namespace Org.OpenAPITools.Api 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); @@ -1710,22 +1710,6 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.Operation = "PetApi.UpdatePet"; localVarRequestOptions.OperationIndex = operationIndex; - // 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); - } - } - } // authentication (petstore_auth) required // oauth required if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) @@ -1742,6 +1726,22 @@ namespace Org.OpenAPITools.Api 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); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/README.md index ebdd6ee67ee..5f5c5608d9b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/README.md @@ -142,13 +142,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -159,3 +152,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index 4d4be89ffbc..f7defb79030 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -203,6 +203,17 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### 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 @@ -219,29 +230,18 @@ Class | Method | HTTP request | Description - **Location**: URL query string -### bearer_test - - -- **Type**: HTTP bearer authentication - - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + + +- **Type**: HTTP bearer authentication + + ### http_signature_test - -### 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 - diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index e64b0643720..96fe3403a66 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -173,6 +173,36 @@ Class | Method | HTTP request | Description +### 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 + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. + +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + + ### api_key - **Type**: API key @@ -206,36 +236,6 @@ r, err := client.Service.Operation(auth, args) ``` -### 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 - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -import "golang.org/x/oauth2" - -/* Perform OAuth2 round trip request and obtain a token */ - -tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - - ## Documentation for Utility Methods Due to the fact that model structure members are all pointers, this package contains diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs index f6f7e973276..a51253d9b2f 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -2430,6 +2430,19 @@ toOuterEnum = \case -- * Auth Methods +-- ** AuthOAuthPetstoreAuth +data AuthOAuthPetstoreAuth = + AuthOAuthPetstoreAuth Text -- ^ secret + deriving (P.Eq, P.Show, P.Typeable) + +instance AuthMethod AuthOAuthPetstoreAuth where + applyAuthMethod _ a@(AuthOAuthPetstoreAuth secret) req = + P.pure $ + if (P.typeOf a `P.elem` rAuthTypes req) + then req `setHeader` toHeader ("Authorization", "Bearer " <> secret) + & L.over rAuthTypesL (P.filter (/= P.typeOf a)) + else req + -- ** AuthApiKeyApiKey data AuthApiKeyApiKey = AuthApiKeyApiKey Text -- ^ secret @@ -2470,17 +2483,4 @@ instance AuthMethod AuthBasicHttpBasicTest where else req where cred = BC.append "Basic " (B64.encode $ BC.concat [ user, ":", pw ]) --- ** AuthOAuthPetstoreAuth -data AuthOAuthPetstoreAuth = - AuthOAuthPetstoreAuth Text -- ^ secret - deriving (P.Eq, P.Show, P.Typeable) - -instance AuthMethod AuthOAuthPetstoreAuth where - applyAuthMethod _ a@(AuthOAuthPetstoreAuth secret) req = - P.pure $ - if (P.typeOf a `P.elem` rAuthTypes req) - then req `setHeader` toHeader ("Authorization", "Bearer " <> secret) - & L.over rAuthTypesL (P.filter (/= P.typeOf a)) - else req - diff --git a/samples/client/petstore/java-micronaut-client/docs/apis/auth.md b/samples/client/petstore/java-micronaut-client/docs/apis/auth.md index 97f37d68202..e8dea0d66f4 100644 --- a/samples/client/petstore/java-micronaut-client/docs/apis/auth.md +++ b/samples/client/petstore/java-micronaut-client/docs/apis/auth.md @@ -1,5 +1,15 @@ # Authorization methods +# petstore_auth +Authorization method is **OAuth2** with `implicit` flow. +The scopes are: + * `write:pets` + * `read:pets` + +It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. + +More information on configuring can be found in [Micronaut Security Guide](https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth). + # api_key Authorization method is of **api key type**. The parameter `api_key` is located in `header`. @@ -14,13 +24,3 @@ It can be configured in the [application.yml](src/main/resources/application.yml Authorization method is of **basic auth**. It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. - -# petstore_auth -Authorization method is **OAuth2** with `implicit` flow. -The scopes are: - * `write:pets` - * `read:pets` - -It can be configured in the [application.yml](src/main/resources/application.yml) using Micronaut security features. - -More information on configuring can be found in [Micronaut Security Guide](https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth). diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index cc099907a84..45ace68ceee 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -204,6 +204,16 @@ Class | Method | HTTP request | Description ## 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 @@ -218,12 +228,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -233,16 +243,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java index 70b456cadfd..a8620ed4e71 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/ApiClient.java @@ -172,12 +172,12 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 41b1d1e5cf8..868c07e3dea 100644 --- a/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -58,14 +58,14 @@ public class ApiClient { for(String authName : authNames) { log.log(Level.FINE, "Creating authentication {0}", authName); RequestInterceptor auth; - if ("api_key".equals(authName)) { + if ("petstore_auth".equals(authName)) { + auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); } else if ("api_key_query".equals(authName)) { auth = new ApiKeyAuth("query", "api_key_query"); } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { - auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java index 0923b7f67d5..69202216e6b 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/ApiClient.java @@ -59,18 +59,18 @@ public class ApiClient { for(String authName : authNames) { log.log(Level.FINE, "Creating authentication {0}", authName); RequestInterceptor auth; - if ("api_key".equals(authName)) { + if ("petstore_auth".equals(authName)) { + auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); } else if ("api_key_query".equals(authName)) { auth = new ApiKeyAuth("query", "api_key_query"); - } else if ("bearer_test".equals(authName)) { - auth = new HttpBearerAuth("bearer"); } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); + } else if ("bearer_test".equals(authName)) { + auth = new HttpBearerAuth("bearer"); } else if ("http_signature_test".equals(authName)) { auth = new HttpBearerAuth("signature"); - } else if ("petstore_auth".equals(authName)) { - auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/google-api-client/README.md b/samples/client/petstore/java/google-api-client/README.md index 407d5e33750..0b08bf579e7 100644 --- a/samples/client/petstore/java/google-api-client/README.md +++ b/samples/client/petstore/java/google-api-client/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/jersey1/README.md b/samples/client/petstore/java/jersey1/README.md index 66229763532..f137bef7607 100644 --- a/samples/client/petstore/java/jersey1/README.md +++ b/samples/client/petstore/java/jersey1/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java index 126f041bdaa..e02dbb80725 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/ApiClient.java @@ -102,10 +102,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/README.md b/samples/client/petstore/java/jersey2-java8-localdatetime/README.md index 2c7cf3a4a93..65c2604a2a8 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/README.md +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/README.md @@ -232,6 +232,16 @@ Class | Method | HTTP request | Description ## 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 @@ -251,16 +261,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java index edd349531d9..571478b2b46 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java @@ -127,6 +127,14 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); Authentication auth = null; + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } if (authMap != null) { auth = authMap.get("api_key"); } @@ -151,14 +159,6 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("http_basic_test", new HttpBasicAuth()); } - if (authMap != null) { - auth = authMap.get("petstore_auth"); - } - if (auth instanceof OAuth) { - authentications.put("petstore_auth", auth); - } else { - authentications.put("petstore_auth", new OAuth(basePath, "")); - } // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/jersey2-java8/README.md b/samples/client/petstore/java/jersey2-java8/README.md index f26cc2fa176..c2b1bfa34dd 100644 --- a/samples/client/petstore/java/jersey2-java8/README.md +++ b/samples/client/petstore/java/jersey2-java8/README.md @@ -232,6 +232,16 @@ Class | Method | HTTP request | Description ## 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 @@ -251,16 +261,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index edd349531d9..571478b2b46 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -127,6 +127,14 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); Authentication auth = null; + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } if (authMap != null) { auth = authMap.get("api_key"); } @@ -151,14 +159,6 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("http_basic_test", new HttpBasicAuth()); } - if (authMap != null) { - auth = authMap.get("petstore_auth"); - } - if (auth instanceof OAuth) { - authentications.put("petstore_auth", auth); - } else { - authentications.put("petstore_auth", new OAuth(basePath, "")); - } // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/jersey3/README.md b/samples/client/petstore/java/jersey3/README.md index dc3e68ec42f..dd55b36a2ac 100644 --- a/samples/client/petstore/java/jersey3/README.md +++ b/samples/client/petstore/java/jersey3/README.md @@ -237,6 +237,16 @@ Class | Method | HTTP request | Description ## 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 @@ -251,12 +261,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -266,16 +276,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/jersey3/docs/PetApi.md b/samples/client/petstore/java/jersey3/docs/PetApi.md index eb2957e4705..b6096623c13 100644 --- a/samples/client/petstore/java/jersey3/docs/PetApi.md +++ b/samples/client/petstore/java/jersey3/docs/PetApi.md @@ -40,11 +40,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -73,7 +73,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -181,11 +181,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -215,7 +215,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -253,11 +253,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -287,7 +287,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -399,11 +399,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -432,7 +432,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java index 838ff0f11cc..420467ff9db 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/ApiClient.java @@ -197,6 +197,14 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); Authentication auth = null; + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } if (authMap != null) { auth = authMap.get("api_key"); } @@ -213,14 +221,6 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); } - if (authMap != null) { - auth = authMap.get("bearer_test"); - } - if (auth instanceof HttpBearerAuth) { - authentications.put("bearer_test", auth); - } else { - authentications.put("bearer_test", new HttpBearerAuth("bearer")); - } if (authMap != null) { auth = authMap.get("http_basic_test"); } @@ -229,20 +229,20 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("http_basic_test", new HttpBasicAuth()); } + if (authMap != null) { + auth = authMap.get("bearer_test"); + } + if (auth instanceof HttpBearerAuth) { + authentications.put("bearer_test", auth); + } else { + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + } if (authMap != null) { auth = authMap.get("http_signature_test"); } if (auth instanceof HttpSignatureAuth) { authentications.put("http_signature_test", auth); } - if (authMap != null) { - auth = authMap.get("petstore_auth"); - } - if (auth instanceof OAuth) { - authentications.put("petstore_auth", auth); - } else { - authentications.put("petstore_auth", new OAuth(basePath, "")); - } // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java index 42eb2a83dc1..273c7ffb489 100644 --- a/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey3/src/main/java/org/openapitools/client/api/PetApi.java @@ -105,7 +105,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, @@ -242,7 +242,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; GenericType> localVarReturnType = new GenericType>() {}; @@ -316,7 +316,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; GenericType> localVarReturnType = new GenericType>() {}; @@ -458,7 +458,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, diff --git a/samples/client/petstore/java/native-async/README.md b/samples/client/petstore/java/native-async/README.md index dd6895f78fd..cf4e76b2e59 100644 --- a/samples/client/petstore/java/native-async/README.md +++ b/samples/client/petstore/java/native-async/README.md @@ -269,6 +269,16 @@ Class | Method | HTTP request | Description ## 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 @@ -283,12 +293,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -298,16 +308,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/native-async/docs/PetApi.md b/samples/client/petstore/java/native-async/docs/PetApi.md index 292c5c0f029..1ac2bae8504 100644 --- a/samples/client/petstore/java/native-async/docs/PetApi.md +++ b/samples/client/petstore/java/native-async/docs/PetApi.md @@ -50,11 +50,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -84,7 +84,7 @@ CompletableFuture (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -122,11 +122,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -165,7 +165,7 @@ CompletableFuture> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -358,11 +358,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -393,7 +393,7 @@ CompletableFuture<[**List<Pet>**](Pet.md)> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -432,11 +432,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -476,7 +476,7 @@ CompletableFuture> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -515,11 +515,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -550,7 +550,7 @@ CompletableFuture<[**List<Pet>**](Pet.md)> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -589,11 +589,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -633,7 +633,7 @@ CompletableFuture> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -833,11 +833,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -867,7 +867,7 @@ CompletableFuture (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -907,11 +907,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -950,7 +950,7 @@ CompletableFuture> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/java/native-jakarta/README.md b/samples/client/petstore/java/native-jakarta/README.md index 472997f1c7d..7f5e0c87672 100644 --- a/samples/client/petstore/java/native-jakarta/README.md +++ b/samples/client/petstore/java/native-jakarta/README.md @@ -160,13 +160,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -177,6 +170,13 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/native/README.md b/samples/client/petstore/java/native/README.md index 9f567db00ce..9bb58bc15eb 100644 --- a/samples/client/petstore/java/native/README.md +++ b/samples/client/petstore/java/native/README.md @@ -268,6 +268,16 @@ Class | Method | HTTP request | Description ## 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 @@ -282,12 +292,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -297,16 +307,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/native/docs/PetApi.md b/samples/client/petstore/java/native/docs/PetApi.md index 4a64885076e..f818ead041c 100644 --- a/samples/client/petstore/java/native/docs/PetApi.md +++ b/samples/client/petstore/java/native/docs/PetApi.md @@ -49,11 +49,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -83,7 +83,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -120,11 +120,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -156,7 +156,7 @@ ApiResponse ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -339,11 +339,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -374,7 +374,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -412,11 +412,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -449,7 +449,7 @@ ApiResponse<[**List<Pet>**](Pet.md)> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -487,11 +487,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -522,7 +522,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -560,11 +560,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -597,7 +597,7 @@ ApiResponse<[**List<Pet>**](Pet.md)> ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -787,11 +787,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -821,7 +821,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -860,11 +860,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -896,7 +896,7 @@ ApiResponse ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/README.md b/samples/client/petstore/java/okhttp-gson-awsv4signature/README.md index 67db50dbe39..ebbaac626f4 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/README.md +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/README.md @@ -155,12 +155,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -170,6 +164,12 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java index bd8c1f4b683..46f93839891 100644 --- a/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-awsv4signature/src/main/java/org/openapitools/client/ApiClient.java @@ -105,8 +105,8 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("AWS4Auth", new AWS4Auth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -123,8 +123,8 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("AWS4Auth", new AWS4Auth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md index 054726451fd..8fb7ff73190 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md @@ -207,6 +207,15 @@ Class | Method | HTTP request | Description ## 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 @@ -223,15 +232,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index 7ddd5940012..24992176187 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -112,10 +112,10 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -131,10 +131,10 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/README.md b/samples/client/petstore/java/okhttp-gson-group-parameter/README.md index 304abc8eb5d..c85dbe0a807 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/README.md +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/README.md @@ -142,12 +142,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -157,6 +151,12 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java index 159439f226b..0c89459d8b6 100644 --- a/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-group-parameter/src/main/java/org/openapitools/client/ApiClient.java @@ -104,8 +104,8 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -121,8 +121,8 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md index b3e111f6884..bea3268deea 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md @@ -207,6 +207,15 @@ Class | Method | HTTP request | Description ## 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 @@ -223,15 +232,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index 6bf3a6f654b..a3e03f9c9cf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -104,10 +104,10 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -123,10 +123,10 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/README.md b/samples/client/petstore/java/okhttp-gson-swagger1/README.md index 7fece84f9ba..b51dc4c0b2f 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/README.md +++ b/samples/client/petstore/java/okhttp-gson-swagger1/README.md @@ -153,12 +153,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth - **Type**: OAuth @@ -168,6 +162,12 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java index 159439f226b..0c89459d8b6 100644 --- a/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -104,8 +104,8 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -121,8 +121,8 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 710fdcd645b..1c47396314b 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -241,6 +241,15 @@ Class | Method | HTTP request | Description ## 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 @@ -253,11 +262,11 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -265,15 +274,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md index c781e07e7b2..94ed9581e6c 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md @@ -38,11 +38,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -70,7 +70,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -173,11 +173,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -206,7 +206,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -242,11 +242,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -275,7 +275,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -382,11 +382,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -414,7 +414,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index ee4f12edb06..cd4e46b4d77 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -147,12 +147,12 @@ public class ApiClient { initHttpClient(); // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -168,12 +168,12 @@ public class ApiClient { httpClient = client; // Setup authentications (key: authentication name, value: authentication). + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } @@ -241,8 +241,8 @@ public class ApiClient { // Setup authentications (key: authentication name, value: authentication). authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); // Prevent the authentications from being modified. diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java index 5b6191cd4dc..92afa6c63fa 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java @@ -128,7 +128,7 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -378,7 +378,7 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -511,7 +511,7 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -778,7 +778,7 @@ public class PetApi { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } diff --git a/samples/client/petstore/java/resteasy/README.md b/samples/client/petstore/java/resteasy/README.md index 18680ec4a79..ea31b284bf4 100644 --- a/samples/client/petstore/java/resteasy/README.md +++ b/samples/client/petstore/java/resteasy/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java index aa848d48d5e..b1602f36476 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java @@ -81,10 +81,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/resttemplate-jakarta/README.md b/samples/client/petstore/java/resttemplate-jakarta/README.md index bc7288a4ef4..303aac2d5af 100644 --- a/samples/client/petstore/java/resttemplate-jakarta/README.md +++ b/samples/client/petstore/java/resttemplate-jakarta/README.md @@ -152,13 +152,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -169,6 +162,13 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/resttemplate-jakarta/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-jakarta/src/main/java/org/openapitools/client/ApiClient.java index 0e8d6ef6047..c6b8de1d33d 100644 --- a/samples/client/petstore/java/resttemplate-jakarta/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-jakarta/src/main/java/org/openapitools/client/ApiClient.java @@ -111,8 +111,8 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/resttemplate-swagger1/README.md b/samples/client/petstore/java/resttemplate-swagger1/README.md index bc7288a4ef4..303aac2d5af 100644 --- a/samples/client/petstore/java/resttemplate-swagger1/README.md +++ b/samples/client/petstore/java/resttemplate-swagger1/README.md @@ -152,13 +152,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -169,6 +162,13 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/client/petstore/java/resttemplate-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-swagger1/src/main/java/org/openapitools/client/ApiClient.java index dc250a75c79..1adabd0c01a 100644 --- a/samples/client/petstore/java/resttemplate-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -111,8 +111,8 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("petstore_auth", new OAuth()); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/resttemplate-withXml/README.md b/samples/client/petstore/java/resttemplate-withXml/README.md index c002d39b0de..4c4642113b2 100644 --- a/samples/client/petstore/java/resttemplate-withXml/README.md +++ b/samples/client/petstore/java/resttemplate-withXml/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java index 8340b6cfa8e..a94b4917a8c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java @@ -117,10 +117,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/resttemplate/README.md b/samples/client/petstore/java/resttemplate/README.md index a0f9bd27d14..2bace9845b1 100644 --- a/samples/client/petstore/java/resttemplate/README.md +++ b/samples/client/petstore/java/resttemplate/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java index b1d9b1cf1d2..64b9513ef33 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java @@ -112,10 +112,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java index fe579c7b817..b5dcb27711e 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java @@ -58,10 +58,10 @@ public class ApiClient { public ApiClient() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap<>(); + // authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); // authentications.put("http_basic_test", new HttpBasicAuth()); - // authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java index ae1e0d9476d..7f90cdd6246 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/ApiClient.java @@ -53,7 +53,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if ("api_key".equals(authName)) { + if ("petstore_auth".equals(authName)) { + + auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); } else if ("api_key_query".equals(authName)) { @@ -63,9 +66,6 @@ public class ApiClient { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { - - auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java index 6077194ccee..3dbf27ad758 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/ApiClient.java @@ -54,7 +54,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if ("api_key".equals(authName)) { + if ("petstore_auth".equals(authName)) { + + auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); } else if ("api_key_query".equals(authName)) { @@ -64,9 +67,6 @@ public class ApiClient { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { - - auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java index 404a311e73f..c1e9542ea98 100644 --- a/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx3/src/main/java/org/openapitools/client/ApiClient.java @@ -54,7 +54,10 @@ public class ApiClient { this(); for(String authName : authNames) { Interceptor auth; - if ("api_key".equals(authName)) { + if ("petstore_auth".equals(authName)) { + + auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); } else if ("api_key_query".equals(authName)) { @@ -64,9 +67,6 @@ public class ApiClient { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { - - auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); } else { throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } diff --git a/samples/client/petstore/java/vertx-no-nullable/README.md b/samples/client/petstore/java/vertx-no-nullable/README.md index 723d1fc53ad..00456e7d15f 100644 --- a/samples/client/petstore/java/vertx-no-nullable/README.md +++ b/samples/client/petstore/java/vertx-no-nullable/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java index 10f7d1935d0..92cd39bf740 100644 --- a/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/vertx-no-nullable/src/main/java/org/openapitools/client/ApiClient.java @@ -82,10 +82,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). this.authentications = new HashMap<>(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. this.authentications = Collections.unmodifiableMap(authentications); @@ -667,6 +667,12 @@ public class ApiClient extends JavaTimeFormatter { private final Map authentications = new LinkedHashMap<>(); + public void addPetstore_authAuthentication(String accessToken) { + OAuth auth = new OAuth(); + auth.setAccessToken(accessToken); + authentications.put("petstore_auth", auth); + } + public void addApi_keyAuthentication(String apikey, String apiKeyPrefix) { ApiKeyAuth auth = new ApiKeyAuth("header","api_key"); auth.setApiKey(apikey); @@ -688,10 +694,10 @@ public class ApiClient extends JavaTimeFormatter { authentications.put("http_basic_test", auth); } - public void addPetstore_authAuthentication(String accessToken) { - OAuth auth = new OAuth(); - auth.setAccessToken(accessToken); - authentications.put("petstore_auth", auth); + public static AuthInfo forPetstore_authAuthentication(String accessToken) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addPetstore_authAuthentication(accessToken); + return authInfo; } public static AuthInfo forApi_keyAuthentication(String apikey, String apiKeyPrefix) { @@ -711,11 +717,5 @@ public class ApiClient extends JavaTimeFormatter { authInfo.addHttp_basic_testAuthentication(username, password); return authInfo; } - - public static AuthInfo forPetstore_authAuthentication(String accessToken) { - AuthInfo authInfo = new AuthInfo(); - authInfo.addPetstore_authAuthentication(accessToken); - return authInfo; - } } } diff --git a/samples/client/petstore/java/vertx/README.md b/samples/client/petstore/java/vertx/README.md index 458bde9cb7d..fd7796984d0 100644 --- a/samples/client/petstore/java/vertx/README.md +++ b/samples/client/petstore/java/vertx/README.md @@ -207,6 +207,16 @@ Class | Method | HTTP request | Description ## 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 @@ -226,16 +236,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java index 7b2ef6e985f..4cba46ae302 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/ApiClient.java @@ -85,10 +85,10 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). this.authentications = new HashMap<>(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. this.authentications = Collections.unmodifiableMap(authentications); @@ -670,6 +670,12 @@ public class ApiClient extends JavaTimeFormatter { private final Map authentications = new LinkedHashMap<>(); + public void addPetstore_authAuthentication(String accessToken) { + OAuth auth = new OAuth(); + auth.setAccessToken(accessToken); + authentications.put("petstore_auth", auth); + } + public void addApi_keyAuthentication(String apikey, String apiKeyPrefix) { ApiKeyAuth auth = new ApiKeyAuth("header","api_key"); auth.setApiKey(apikey); @@ -691,10 +697,10 @@ public class ApiClient extends JavaTimeFormatter { authentications.put("http_basic_test", auth); } - public void addPetstore_authAuthentication(String accessToken) { - OAuth auth = new OAuth(); - auth.setAccessToken(accessToken); - authentications.put("petstore_auth", auth); + public static AuthInfo forPetstore_authAuthentication(String accessToken) { + AuthInfo authInfo = new AuthInfo(); + authInfo.addPetstore_authAuthentication(accessToken); + return authInfo; } public static AuthInfo forApi_keyAuthentication(String apikey, String apiKeyPrefix) { @@ -714,11 +720,5 @@ public class ApiClient extends JavaTimeFormatter { authInfo.addHttp_basic_testAuthentication(username, password); return authInfo; } - - public static AuthInfo forPetstore_authAuthentication(String accessToken) { - AuthInfo authInfo = new AuthInfo(); - authInfo.addPetstore_authAuthentication(accessToken); - return authInfo; - } } } diff --git a/samples/client/petstore/java/webclient-jakarta/README.md b/samples/client/petstore/java/webclient-jakarta/README.md index c184d5d4186..75a5fba59e2 100644 --- a/samples/client/petstore/java/webclient-jakarta/README.md +++ b/samples/client/petstore/java/webclient-jakarta/README.md @@ -211,6 +211,16 @@ Class | Method | HTTP request | Description ## 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 @@ -225,12 +235,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -240,16 +250,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/ApiClient.java index 33801c567d1..c5ba27b85c3 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/ApiClient.java @@ -147,12 +147,12 @@ public class ApiClient extends JavaTimeFormatter { protected void init() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index c184d5d4186..75a5fba59e2 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -211,6 +211,16 @@ Class | Method | HTTP request | Description ## 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 @@ -225,12 +235,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -240,16 +250,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java index a3b21aac840..009552ddb72 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/ApiClient.java @@ -147,12 +147,12 @@ public class ApiClient extends JavaTimeFormatter { protected void init() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); + authentications.put("petstore_auth", new OAuth()); authentications.put("api_key", new ApiKeyAuth("header", "api_key")); authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("bearer_test", new HttpBearerAuth("bearer")); authentications.put("http_signature_test", new HttpBearerAuth("signature")); - authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); } diff --git a/samples/client/petstore/javascript-apollo/README.md b/samples/client/petstore/javascript-apollo/README.md index 00a573ce112..e7354779cfd 100644 --- a/samples/client/petstore/javascript-apollo/README.md +++ b/samples/client/petstore/javascript-apollo/README.md @@ -224,6 +224,18 @@ Class | Method | HTTP request | Description +### 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 @@ -242,30 +254,18 @@ Class | Method | HTTP request | Description -### bearer_test - -- **Type**: Bearer authentication (JWT) - - - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + + + ### http_signature_test - - -### 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 - diff --git a/samples/client/petstore/javascript-apollo/src/ApiClient.js b/samples/client/petstore/javascript-apollo/src/ApiClient.js index 97d65f916f3..b900791248f 100644 --- a/samples/client/petstore/javascript-apollo/src/ApiClient.js +++ b/samples/client/petstore/javascript-apollo/src/ApiClient.js @@ -41,11 +41,11 @@ export default class ApiClient extends RESTDataSource { * @type {Array.} */ this.authentications = { + 'petstore_auth': {type: 'oauth2'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, 'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'}, - 'bearer_test': {type: 'bearer'}, // JWT 'http_basic_test': {type: 'basic'}, - 'petstore_auth': {type: 'oauth2'} + 'bearer_test': {type: 'bearer'}, // JWT } } diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 00a573ce112..e7354779cfd 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -224,6 +224,18 @@ Class | Method | HTTP request | Description +### 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 @@ -242,30 +254,18 @@ Class | Method | HTTP request | Description -### bearer_test - -- **Type**: Bearer authentication (JWT) - - - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + + + ### http_signature_test - - -### 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 - diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index ba9979062ff..8c58f5c4911 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -46,11 +46,11 @@ class ApiClient { * @type {Array.} */ this.authentications = { + 'petstore_auth': {type: 'oauth2'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, 'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'}, - 'bearer_test': {type: 'bearer'}, // JWT 'http_basic_test': {type: 'basic'}, - 'petstore_auth': {type: 'oauth2'} + 'bearer_test': {type: 'bearer'}, // JWT } /** diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index 3d310993bda..3592d05eb36 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -222,6 +222,18 @@ Class | Method | HTTP request | Description +### 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 @@ -240,30 +252,18 @@ Class | Method | HTTP request | Description -### bearer_test - -- **Type**: Bearer authentication (JWT) - - - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + + + ### http_signature_test - - -### 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 - diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index 03bfd25d572..44d8c46bc33 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -46,11 +46,11 @@ class ApiClient { * @type {Array.} */ this.authentications = { + 'petstore_auth': {type: 'oauth2'}, 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, 'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'}, - 'bearer_test': {type: 'bearer'}, // JWT 'http_basic_test': {type: 'basic'}, - 'petstore_auth': {type: 'oauth2'} + 'bearer_test': {type: 'bearer'}, // JWT } /** diff --git a/samples/client/petstore/kotlin-gson/README.md b/samples/client/petstore/kotlin-gson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-gson/README.md +++ b/samples/client/petstore/kotlin-gson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index e983cd91a2f..150ae2c96a1 100644 --- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -143,6 +143,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -152,11 +157,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-jackson/README.md b/samples/client/petstore/kotlin-jackson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jackson/README.md +++ b/samples/client/petstore/kotlin-jackson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 18950f7e724..40f766cd0a3 100644 --- a/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -143,6 +143,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -152,11 +157,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-json-request-string/README.md b/samples/client/petstore/kotlin-json-request-string/README.md index 7989ca8e5aa..dcf5aba4ef4 100644 --- a/samples/client/petstore/kotlin-json-request-string/README.md +++ b/samples/client/petstore/kotlin-json-request-string/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index e33a5625aed..cfa514eddfa 100644 --- a/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-json-request-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -149,6 +149,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -158,11 +163,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 69c803dfbcf..6e9f0602334 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -48,8 +48,8 @@ open class ApiClient( private val authentications: kotlin.collections.Map by lazy { mapOf( - "api_key" to ApiKeyAuth("header", "api_key"), - "petstore_auth" to OAuth()) + "petstore_auth" to OAuth(), + "api_key" to ApiKeyAuth("header", "api_key")) } companion object { diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/README.md b/samples/client/petstore/kotlin-jvm-ktor-jackson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/README.md +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index bb3a5290cf6..69fcc0ab854 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -52,8 +52,8 @@ open class ApiClient( private val authentications: kotlin.collections.Map by lazy { mapOf( - "api_key" to ApiKeyAuth("header", "api_key"), - "petstore_auth" to OAuth()) + "petstore_auth" to OAuth(), + "api_key" to ApiKeyAuth("header", "api_key")) } companion object { diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d7c20c5f81d..de295015574 100644 --- a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -146,6 +146,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -155,11 +160,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected suspend inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-jvm-vertx-gson/README.md b/samples/client/petstore/kotlin-jvm-vertx-gson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-gson/README.md +++ b/samples/client/petstore/kotlin-jvm-vertx-gson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/README.md b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/README.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson-coroutines/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-vertx-jackson/README.md b/samples/client/petstore/kotlin-jvm-vertx-jackson/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-jackson/README.md +++ b/samples/client/petstore/kotlin-jvm-vertx-jackson/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-vertx-moshi/README.md b/samples/client/petstore/kotlin-jvm-vertx-moshi/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-jvm-vertx-moshi/README.md +++ b/samples/client/petstore/kotlin-jvm-vertx-moshi/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-volley/README.md b/samples/client/petstore/kotlin-jvm-volley/README.md index 1f4eeea12ff..ea70a2c10aa 100644 --- a/samples/client/petstore/kotlin-jvm-volley/README.md +++ b/samples/client/petstore/kotlin-jvm-volley/README.md @@ -211,13 +211,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -228,3 +221,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-jvm-volley/src/main/java/org/openapitools/client/request/RequestFactory.kt b/samples/client/petstore/kotlin-jvm-volley/src/main/java/org/openapitools/client/request/RequestFactory.kt index 09276ebbe3e..87d83e3a44a 100644 --- a/samples/client/petstore/kotlin-jvm-volley/src/main/java/org/openapitools/client/request/RequestFactory.kt +++ b/samples/client/petstore/kotlin-jvm-volley/src/main/java/org/openapitools/client/request/RequestFactory.kt @@ -15,6 +15,7 @@ class RequestFactory(private val headerFactories : List<() -> Map Map ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fd43ff24fe2..9101fb150a8 100644 --- a/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-modelMutable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-moshi-codegen/README.md b/samples/client/petstore/kotlin-moshi-codegen/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/README.md +++ b/samples/client/petstore/kotlin-moshi-codegen/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fd43ff24fe2..9101fb150a8 100644 --- a/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-moshi-codegen/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-multiplatform/README.md b/samples/client/petstore/kotlin-multiplatform/README.md index 923b987751d..5fef7c71f8a 100644 --- a/samples/client/petstore/kotlin-multiplatform/README.md +++ b/samples/client/petstore/kotlin-multiplatform/README.md @@ -71,13 +71,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -88,3 +81,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 35e549b9829..8e52ce88067 100644 --- a/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -38,8 +38,8 @@ open class ApiClient( private val authentications: kotlin.collections.Map by lazy { mapOf( - "api_key" to ApiKeyAuth("header", "api_key"), - "petstore_auth" to OAuth()) + "petstore_auth" to OAuth(), + "api_key" to ApiKeyAuth("header", "api_key")) } companion object { diff --git a/samples/client/petstore/kotlin-nonpublic/README.md b/samples/client/petstore/kotlin-nonpublic/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-nonpublic/README.md +++ b/samples/client/petstore/kotlin-nonpublic/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index be98a7761be..504d6920a4f 100644 --- a/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nonpublic/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ internal open class ApiClient(val baseUrl: String, val client: OkHttpClient = de } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ internal open class ApiClient(val baseUrl: String, val client: OkHttpClient = de } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-nullable/README.md b/samples/client/petstore/kotlin-nullable/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-nullable/README.md +++ b/samples/client/petstore/kotlin-nullable/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fd43ff24fe2..9101fb150a8 100644 --- a/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-nullable/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-okhttp3/README.md b/samples/client/petstore/kotlin-okhttp3/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-okhttp3/README.md +++ b/samples/client/petstore/kotlin-okhttp3/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index d87c7b38855..6985de61199 100644 --- a/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-okhttp3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -142,6 +142,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -151,11 +156,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md index a92b6bad736..f6ddc74a3fd 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 2cc80d48407..9524d49b38a 100644 --- a/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -64,7 +64,7 @@ class ApiClient( ) : this(baseUrl, okHttpClientBuilder) { authNames.forEach { authName -> val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") + "petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key") else -> throw RuntimeException("auth name $authName not found in available auth names") } addAuthorization(authName, auth) diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/README.md b/samples/client/petstore/kotlin-retrofit2-rx3/README.md index a92b6bad736..f6ddc74a3fd 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/README.md +++ b/samples/client/petstore/kotlin-retrofit2-rx3/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 561935b85fc..0105b231cc3 100644 --- a/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-retrofit2-rx3/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -67,7 +67,7 @@ class ApiClient( ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { authNames.forEach { authName -> val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") + "petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key") else -> throw RuntimeException("auth name $authName not found in available auth names") } addAuthorization(authName, auth) diff --git a/samples/client/petstore/kotlin-retrofit2/README.md b/samples/client/petstore/kotlin-retrofit2/README.md index a92b6bad736..f6ddc74a3fd 100644 --- a/samples/client/petstore/kotlin-retrofit2/README.md +++ b/samples/client/petstore/kotlin-retrofit2/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 09694992a6b..b7be4c89f7b 100644 --- a/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -64,7 +64,7 @@ class ApiClient( ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) { authNames.forEach { authName -> val auth = when (authName) { - "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets") + "petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key") else -> throw RuntimeException("auth name $authName not found in available auth names") } addAuthorization(authName, auth) diff --git a/samples/client/petstore/kotlin-string/README.md b/samples/client/petstore/kotlin-string/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-string/README.md +++ b/samples/client/petstore/kotlin-string/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fd43ff24fe2..9101fb150a8 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin-threetenbp/README.md b/samples/client/petstore/kotlin-threetenbp/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin-threetenbp/README.md +++ b/samples/client/petstore/kotlin-threetenbp/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index 69b4dcef602..d26ef5fe23f 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/kotlin/README.md b/samples/client/petstore/kotlin/README.md index e639c6d6636..8fd412db314 100644 --- a/samples/client/petstore/kotlin/README.md +++ b/samples/client/petstore/kotlin/README.md @@ -80,13 +80,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -97,3 +90,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index fd43ff24fe2..9101fb150a8 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -144,6 +144,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } protected fun updateAuthParams(requestConfig: RequestConfig) { + if (requestConfig.headers[Authorization].isNullOrEmpty()) { + accessToken?.let { accessToken -> + requestConfig.headers[Authorization] = "Bearer $accessToken " + } + } if (requestConfig.headers["api_key"].isNullOrEmpty()) { if (apiKey["api_key"] != null) { if (apiKeyPrefix["api_key"] != null) { @@ -153,11 +158,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie } } } - if (requestConfig.headers[Authorization].isNullOrEmpty()) { - accessToken?.let { accessToken -> - requestConfig.headers[Authorization] = "Bearer $accessToken " - } - } } protected inline fun request(requestConfig: RequestConfig): ApiResponse { diff --git a/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m index 36fecb1dd44..9a774f3d9b7 100644 --- a/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m +++ b/samples/client/petstore/objc/core-data/SwaggerClient/Api/SWGPetApi.m @@ -335,7 +335,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513; NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; // Authentication setting - NSArray *authSettings = @[@"api_key", @"petstore_auth"]; + NSArray *authSettings = @[@"petstore_auth", @"api_key"]; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; diff --git a/samples/client/petstore/objc/core-data/docs/SWGPetApi.md b/samples/client/petstore/objc/core-data/docs/SWGPetApi.md index d47429217b3..47b1b14d8d2 100644 --- a/samples/client/petstore/objc/core-data/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/core-data/docs/SWGPetApi.md @@ -246,14 +246,14 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond ```objc SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; +// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth) +[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; + // Configure API key authorization: (authentication scheme: api_key) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"]; // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed //[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"]; -// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth) -[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; - NSNumber* petId = @56; // ID of pet that needs to be fetched @@ -283,7 +283,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP request headers diff --git a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m index 36fecb1dd44..9a774f3d9b7 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Api/SWGPetApi.m @@ -335,7 +335,7 @@ NSInteger kSWGPetApiMissingParamErrorCode = 234513; NSString *requestContentType = [self.apiClient.sanitizer selectHeaderContentType:@[]]; // Authentication setting - NSArray *authSettings = @[@"api_key", @"petstore_auth"]; + NSArray *authSettings = @[@"petstore_auth", @"api_key"]; id bodyParam = nil; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; diff --git a/samples/client/petstore/objc/default/docs/SWGPetApi.md b/samples/client/petstore/objc/default/docs/SWGPetApi.md index d47429217b3..47b1b14d8d2 100644 --- a/samples/client/petstore/objc/default/docs/SWGPetApi.md +++ b/samples/client/petstore/objc/default/docs/SWGPetApi.md @@ -246,14 +246,14 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond ```objc SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig]; +// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth) +[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; + // Configure API key authorization: (authentication scheme: api_key) [apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"]; // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed //[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"]; -// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth) -[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"]; - NSNumber* petId = @56; // ID of pet that needs to be fetched @@ -283,7 +283,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP request headers diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 6dbce48497d..17380420a74 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -480,6 +480,15 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR AUTHORIZATION +## 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 @@ -492,11 +501,11 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -## bearer_test +## http_basic_test - **Type**: HTTP basic authentication -## http_basic_test +## bearer_test - **Type**: HTTP basic authentication @@ -504,12 +513,3 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm index 0aa1201423f..335cffb1ed4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm @@ -341,6 +341,11 @@ sub update_params_for_auth { if (!defined($auth)) { # TODO show warning about auth setting not defined } + elsif ($auth eq 'petstore_auth') { + if ($self->{config}{access_token}) { + $header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token}; + } + } elsif ($auth eq 'api_key') { my $api_key = $self->get_api_key_with_prefix('api_key'); if ($api_key) { @@ -353,24 +358,19 @@ sub update_params_for_auth { $query_params->{'api_key_query'} = $api_key; } } + elsif ($auth eq 'http_basic_test') { + if ($self->{config}{username} || $self->{config}{password}) { + $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); + } + } elsif ($auth eq 'bearer_test') { # this endpoint requires Bearer (JWT) authentication (access token) if ($self->{config}{access_token}) { $header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token}; } } - elsif ($auth eq 'http_basic_test') { - if ($self->{config}{username} || $self->{config}{password}) { - $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); - } - } elsif ($auth eq 'http_signature_test') { } - elsif ($auth eq 'petstore_auth') { - if ($self->{config}{access_token}) { - $header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token}; - } - } else { # TODO show warning about security definition not found } diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index b7cb4dd4e18..b68c5316fdc 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -167,6 +167,16 @@ Class | Method | HTTP request | Description ## Authorization +### 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 @@ -183,28 +193,18 @@ Class | Method | HTTP request | Description -### bearer_test - -- **Type**: Bearer authentication (JWT) - - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + + ### http_signature_test - -### 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 - ## Tests To run the tests, use: diff --git a/samples/client/petstore/powershell/README.md b/samples/client/petstore/powershell/README.md index 34171d8f12c..90d3d906ba9 100644 --- a/samples/client/petstore/powershell/README.md +++ b/samples/client/petstore/powershell/README.md @@ -177,6 +177,17 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### 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 @@ -193,13 +204,13 @@ Class | Method | HTTP request | Description - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -210,14 +221,3 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication - -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - diff --git a/samples/client/petstore/powershell/docs/PSPetApi.md b/samples/client/petstore/powershell/docs/PSPetApi.md index aa5a2db7167..848b9313f3d 100644 --- a/samples/client/petstore/powershell/docs/PSPetApi.md +++ b/samples/client/petstore/powershell/docs/PSPetApi.md @@ -28,6 +28,9 @@ Add a new pet to the store ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure OAuth2 access token for authorization: petstore_auth +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" + # Configure HTTP basic authorization: http_signature_test $Configuration.Username = "YOUR_USERNAME" $Configuration.Password = "YOUR_PASSWORD" @@ -40,9 +43,6 @@ $httpSigningParams = @{ } Set-ConfigurationHttpSigning $httpSigningParams -# Configure OAuth2 access token for authorization: petstore_auth -$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - $Category = Initialize-Category -Id 0 -Name "MyName" $Tag = Initialize-Tag -Id 0 -Name "MyName" $Pet = Initialize-Pet -Id 0 -Category $Category -Name "doggie" -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | Pet object that needs to be added to the store @@ -68,7 +68,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -141,6 +141,9 @@ Multiple status values can be provided with comma separated strings ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure OAuth2 access token for authorization: petstore_auth +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" + # Configure HTTP basic authorization: http_signature_test $Configuration.Username = "YOUR_USERNAME" $Configuration.Password = "YOUR_PASSWORD" @@ -153,9 +156,6 @@ $httpSigningParams = @{ } Set-ConfigurationHttpSigning $httpSigningParams -# Configure OAuth2 access token for authorization: petstore_auth -$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - $Status = "available" # String[] | Status values that need to be considered for filter # Finds Pets by status @@ -179,7 +179,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -201,6 +201,9 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure OAuth2 access token for authorization: petstore_auth +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" + # Configure HTTP basic authorization: http_signature_test $Configuration.Username = "YOUR_USERNAME" $Configuration.Password = "YOUR_PASSWORD" @@ -213,9 +216,6 @@ $httpSigningParams = @{ } Set-ConfigurationHttpSigning $httpSigningParams -# Configure OAuth2 access token for authorization: petstore_auth -$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - $Tags = "MyTags" # String[] | Tags to filter by # Finds Pets by tags @@ -239,7 +239,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -311,6 +311,9 @@ Update an existing pet ```powershell # general setting of the PowerShell module, e.g. base URL, authentication, etc $Configuration = Get-Configuration +# Configure OAuth2 access token for authorization: petstore_auth +$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" + # Configure HTTP basic authorization: http_signature_test $Configuration.Username = "YOUR_USERNAME" $Configuration.Password = "YOUR_PASSWORD" @@ -323,9 +326,6 @@ $httpSigningParams = @{ } Set-ConfigurationHttpSigning $httpSigningParams -# Configure OAuth2 access token for authorization: petstore_auth -$Configuration.AccessToken = "YOUR_ACCESS_TOKEN" - $Category = Initialize-Category -Id 0 -Name "MyName" $Tag = Initialize-Tag -Id 0 -Name "MyName" $Pet = Initialize-Pet -Id 0 -Category $Category -Name "doggie" -PhotoUrls "MyPhotoUrls" -Tags $Tag -Status "available" # Pet | Pet object that needs to be added to the store @@ -351,7 +351,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md index 24c9052d3dc..968e6776b08 100644 --- a/samples/client/petstore/python-asyncio/README.md +++ b/samples/client/petstore/python-asyncio/README.md @@ -175,6 +175,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -194,16 +204,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py index 38b2562be31..551adf58b77 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/configuration.py +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -405,6 +405,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -430,13 +437,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': self.get_basic_auth_token() } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/client/petstore/python-legacy/README.md b/samples/client/petstore/python-legacy/README.md index 18a172f82cc..432fa7b08c1 100644 --- a/samples/client/petstore/python-legacy/README.md +++ b/samples/client/petstore/python-legacy/README.md @@ -175,6 +175,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -194,16 +204,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/client/petstore/python-legacy/petstore_api/configuration.py b/samples/client/petstore/python-legacy/petstore_api/configuration.py index 000c796fa37..b2fdb5aab13 100644 --- a/samples/client/petstore/python-legacy/petstore_api/configuration.py +++ b/samples/client/petstore/python-legacy/petstore_api/configuration.py @@ -409,6 +409,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -434,13 +441,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': self.get_basic_auth_token() } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/client/petstore/python-prior/README.md b/samples/client/petstore/python-prior/README.md index eb14e3a2d74..f74c3e5a4f5 100644 --- a/samples/client/petstore/python-prior/README.md +++ b/samples/client/petstore/python-prior/README.md @@ -199,6 +199,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -218,16 +228,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/client/petstore/python-prior/petstore_api/configuration.py b/samples/client/petstore/python-prior/petstore_api/configuration.py index e6e4596df11..2dbd330c6a3 100644 --- a/samples/client/petstore/python-prior/petstore_api/configuration.py +++ b/samples/client/petstore/python-prior/petstore_api/configuration.py @@ -405,6 +405,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -430,13 +437,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': self.get_basic_auth_token() } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/README.md b/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/README.md index eb14e3a2d74..f74c3e5a4f5 100644 --- a/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/README.md +++ b/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/README.md @@ -199,6 +199,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -218,16 +228,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py b/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py index e6e4596df11..2dbd330c6a3 100644 --- a/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py +++ b/samples/client/petstore/python-prior_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py @@ -405,6 +405,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -430,13 +437,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': self.get_basic_auth_token() } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index 18a172f82cc..432fa7b08c1 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -175,6 +175,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -194,16 +204,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/client/petstore/python-tornado/petstore_api/configuration.py b/samples/client/petstore/python-tornado/petstore_api/configuration.py index 000c796fa37..b2fdb5aab13 100644 --- a/samples/client/petstore/python-tornado/petstore_api/configuration.py +++ b/samples/client/petstore/python-tornado/petstore_api/configuration.py @@ -409,6 +409,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -434,13 +441,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': self.get_basic_auth_token() } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/client/petstore/ruby-autoload/README.md b/samples/client/petstore/ruby-autoload/README.md index bd15c2fd793..b0f3201a184 100644 --- a/samples/client/petstore/ruby-autoload/README.md +++ b/samples/client/petstore/ruby-autoload/README.md @@ -173,6 +173,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### 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 @@ -187,24 +197,14 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test - -- **Type**: Bearer authentication (JWT) - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + ### http_signature_test -### 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 - diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/configuration.rb b/samples/client/petstore/ruby-autoload/lib/petstore/configuration.rb index 285992e0d3c..2166deaa23d 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/configuration.rb @@ -227,6 +227,13 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { + 'petstore_auth' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, 'api_key' => { type: 'api_key', @@ -241,14 +248,6 @@ module Petstore key: 'api_key_query', value: api_key_with_prefix('api_key_query') }, - 'bearer_test' => - { - type: 'bearer', - in: 'header', - format: 'JWT', - key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" - }, 'http_basic_test' => { type: 'basic', @@ -256,10 +255,11 @@ module Petstore key: 'Authorization', value: basic_auth_token }, - 'petstore_auth' => + 'bearer_test' => { - type: 'oauth2', + type: 'bearer', in: 'header', + format: 'JWT', key: 'Authorization', value: "Bearer #{access_token_with_refresh}" }, diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index bd15c2fd793..b0f3201a184 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -173,6 +173,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### 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 @@ -187,24 +197,14 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test - -- **Type**: Bearer authentication (JWT) - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + ### http_signature_test -### 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 - diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb index fd790900bdf..d9d9bd7f1a5 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/configuration.rb @@ -231,6 +231,13 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { + 'petstore_auth' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, 'api_key' => { type: 'api_key', @@ -245,14 +252,6 @@ module Petstore key: 'api_key_query', value: api_key_with_prefix('api_key_query') }, - 'bearer_test' => - { - type: 'bearer', - in: 'header', - format: 'JWT', - key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" - }, 'http_basic_test' => { type: 'basic', @@ -260,10 +259,11 @@ module Petstore key: 'Authorization', value: basic_auth_token }, - 'petstore_auth' => + 'bearer_test' => { - type: 'oauth2', + type: 'bearer', in: 'header', + format: 'JWT', key: 'Authorization', value: "Bearer #{access_token_with_refresh}" }, diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index bd15c2fd793..b0f3201a184 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -173,6 +173,16 @@ Class | Method | HTTP request | Description ## Documentation for Authorization +### 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 @@ -187,24 +197,14 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test - -- **Type**: Bearer authentication (JWT) - ### http_basic_test - **Type**: HTTP basic authentication +### bearer_test + +- **Type**: Bearer authentication (JWT) + ### http_signature_test -### 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 - diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 285992e0d3c..2166deaa23d 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -227,6 +227,13 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { + 'petstore_auth' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, 'api_key' => { type: 'api_key', @@ -241,14 +248,6 @@ module Petstore key: 'api_key_query', value: api_key_with_prefix('api_key_query') }, - 'bearer_test' => - { - type: 'bearer', - in: 'header', - format: 'JWT', - key: 'Authorization', - value: "Bearer #{access_token_with_refresh}" - }, 'http_basic_test' => { type: 'basic', @@ -256,10 +255,11 @@ module Petstore key: 'Authorization', value: basic_auth_token }, - 'petstore_auth' => + 'bearer_test' => { - type: 'oauth2', + type: 'bearer', in: 'header', + format: 'JWT', key: 'Authorization', value: "Bearer #{access_token_with_refresh}" }, diff --git a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index fd939fc1692..0f5727b8b18 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/alamofireLibrary/README.md b/samples/client/petstore/swift5/alamofireLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/README.md +++ b/samples/client/petstore/swift5/alamofireLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 5c38816673d..c4051ddb97b 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -26,12 +26,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index bfaa1fe298a..8976a588129 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -46,12 +46,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/combineLibrary/README.md b/samples/client/petstore/swift5/combineLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/combineLibrary/README.md +++ b/samples/client/petstore/swift5/combineLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/default/README.md b/samples/client/petstore/swift5/default/README.md index b4551163615..1c842fc9f6c 100644 --- a/samples/client/petstore/swift5/default/README.md +++ b/samples/client/petstore/swift5/default/README.md @@ -121,6 +121,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -137,15 +146,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/deprecated/README.md b/samples/client/petstore/swift5/deprecated/README.md index 619c4036f44..4197afa14ad 100644 --- a/samples/client/petstore/swift5/deprecated/README.md +++ b/samples/client/petstore/swift5/deprecated/README.md @@ -60,6 +60,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -72,15 +81,6 @@ Class | Method | HTTP request | Description - **API key parameter name**: AUTH_KEY - **Location**: -## 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 - ## Author diff --git a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 8437ad00a2c..35aacb16b9a 100644 --- a/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/frozenEnums/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/frozenEnums/README.md b/samples/client/petstore/swift5/frozenEnums/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/frozenEnums/README.md +++ b/samples/client/petstore/swift5/frozenEnums/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/frozenEnums/docs/PetAPI.md b/samples/client/petstore/swift5/frozenEnums/docs/PetAPI.md index 7db99cf8376..3df1bcdfbb6 100644 --- a/samples/client/petstore/swift5/frozenEnums/docs/PetAPI.md +++ b/samples/client/petstore/swift5/frozenEnums/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 88bf373f4da..e828ad27891 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ internal class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/nonPublicApi/README.md b/samples/client/petstore/swift5/nonPublicApi/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/nonPublicApi/README.md +++ b/samples/client/petstore/swift5/nonPublicApi/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md b/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md index 8635a4c340b..5d22a913fc6 100644 --- a/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md +++ b/samples/client/petstore/swift5/nonPublicApi/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index e41eadc6656..6e832c32169 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ import AnyCodable /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/objcCompatible/README.md b/samples/client/petstore/swift5/objcCompatible/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/objcCompatible/README.md +++ b/samples/client/petstore/swift5/objcCompatible/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md index 571bcd0fbca..508d13dae38 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index cb3024703f1..bcff9b37b22 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -35,12 +35,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/promisekitLibrary/README.md b/samples/client/petstore/swift5/promisekitLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/README.md +++ b/samples/client/petstore/swift5/promisekitLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md index 419776868ad..73755de2c49 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md @@ -51,7 +51,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index fd939fc1692..0f5727b8b18 100644 --- a/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/readonlyProperties/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/readonlyProperties/README.md b/samples/client/petstore/swift5/readonlyProperties/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/readonlyProperties/README.md +++ b/samples/client/petstore/swift5/readonlyProperties/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md +++ b/samples/client/petstore/swift5/readonlyProperties/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 11b47c07c90..00136658209 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/resultLibrary/README.md b/samples/client/petstore/swift5/resultLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/resultLibrary/README.md +++ b/samples/client/petstore/swift5/resultLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index c77f9e94482..6d24bf65fee 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -41,12 +41,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/rxswiftLibrary/README.md b/samples/client/petstore/swift5/rxswiftLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md index c376190fb6d..6a03adef99d 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md @@ -44,7 +44,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/urlsessionLibrary/README.md b/samples/client/petstore/swift5/urlsessionLibrary/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 84098b22ee0..60431b44534 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -37,12 +37,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/swift5/vaporLibrary/README.md b/samples/client/petstore/swift5/vaporLibrary/README.md index 18dfa2d16e6..567dc4547a2 100644 --- a/samples/client/petstore/swift5/vaporLibrary/README.md +++ b/samples/client/petstore/swift5/vaporLibrary/README.md @@ -117,6 +117,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -133,15 +142,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index fd939fc1692..0f5727b8b18 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/x-swift-hashable/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -34,12 +34,12 @@ open class PetAPI { /** Add a new pet to the store - POST /pet - - API Key: - - type: apiKey api_key_query (QUERY) - - name: api_key_query - OAuth: - type: oauth2 - name: petstore_auth + - API Key: + - type: apiKey api_key_query (QUERY) + - name: api_key_query - parameter body: (body) Pet object that needs to be added to the store - returns: RequestBuilder */ diff --git a/samples/client/petstore/swift5/x-swift-hashable/README.md b/samples/client/petstore/swift5/x-swift-hashable/README.md index 1725415f7e0..3f64ea16811 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/README.md +++ b/samples/client/petstore/swift5/x-swift-hashable/README.md @@ -109,6 +109,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -125,15 +134,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/client/petstore/swift5/x-swift-hashable/docs/PetAPI.md b/samples/client/petstore/swift5/x-swift-hashable/docs/PetAPI.md index 786640dabb8..e6219c37c4e 100644 --- a/samples/client/petstore/swift5/x-swift-hashable/docs/PetAPI.md +++ b/samples/client/petstore/swift5/x-swift-hashable/docs/PetAPI.md @@ -54,7 +54,7 @@ Void (empty response body) ### Authorization -[api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts index c119def95af..4ad26d0bdcb 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/configuration.ts @@ -87,6 +87,15 @@ export class Configuration { this.credentials = {}; } + // init default petstore_auth credential + if (!this.credentials['petstore_auth']) { + this.credentials['petstore_auth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + // init default api_key credential if (!this.credentials['api_key']) { this.credentials['api_key'] = () => { @@ -97,15 +106,6 @@ export class Configuration { } }; } - - // init default petstore_auth credential - if (!this.credentials['petstore_auth']) { - this.credentials['petstore_auth'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } } /** diff --git a/samples/client/petstore/typescript-aurelia/default/AuthStorage.ts b/samples/client/petstore/typescript-aurelia/default/AuthStorage.ts index 9758cc78ece..377de32d30e 100644 --- a/samples/client/petstore/typescript-aurelia/default/AuthStorage.ts +++ b/samples/client/petstore/typescript-aurelia/default/AuthStorage.ts @@ -20,31 +20,6 @@ export class AuthStorage { this.storage = new Map(); } - /** - * Sets the api_key auth method value. - * - * @param value The new value to set for api_key. - */ - setapi_key(value: string): this { - this.storage.set('api_key', value); - return this; - } - - /** - * Removes the api_key auth method value. - */ - removeapi_key(): this { - this.storage.delete('api_key'); - return this; - } - - /** - * Gets the api_key auth method value. - */ - getapi_key(): null | string { - return this.storage.get('api_key') || null; - } - /** * Sets the petstore_auth auth method value. * @@ -69,4 +44,29 @@ export class AuthStorage { getpetstore_auth(): null | string { return this.storage.get('petstore_auth') || null; } + + /** + * Sets the api_key auth method value. + * + * @param value The new value to set for api_key. + */ + setapi_key(value: string): this { + this.storage.set('api_key', value); + return this; + } + + /** + * Removes the api_key auth method value. + */ + removeapi_key(): this { + this.storage.delete('api_key'); + return this; + } + + /** + * Gets the api_key auth method value. + */ + getapi_key(): null | string { + return this.storage.get('api_key') || null; + } } diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts index f1d0e016393..ee13f714845 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts @@ -3389,12 +3389,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + localVarHeaderParameter['Content-Type'] = 'application/json'; @@ -3474,12 +3474,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); } @@ -3518,12 +3518,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); } @@ -3598,12 +3598,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + localVarHeaderParameter['Content-Type'] = 'application/json'; diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts index c4d9c703ba3..f2c9688a625 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -3034,12 +3034,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + localVarHeaderParameter['Content-Type'] = 'application/json'; @@ -3119,12 +3119,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + if (status) { localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); } @@ -3163,12 +3163,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + if (tags) { localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); } @@ -3243,12 +3243,12 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; - // authentication http_signature_test required - // authentication petstore_auth required // oauth required await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + // authentication http_signature_test required + localVarHeaderParameter['Content-Type'] = 'application/json'; diff --git a/samples/client/petstore/typescript-node/default/api/petApi.ts b/samples/client/petstore/typescript-node/default/api/petApi.ts index d518c2b66c8..f755d42f4da 100644 --- a/samples/client/petstore/typescript-node/default/api/petApi.ts +++ b/samples/client/petstore/typescript-node/default/api/petApi.ts @@ -40,8 +40,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/client/petstore/typescript-node/default/api/storeApi.ts b/samples/client/petstore/typescript-node/default/api/storeApi.ts index 8cb4e74e842..f3f5b8ca651 100644 --- a/samples/client/petstore/typescript-node/default/api/storeApi.ts +++ b/samples/client/petstore/typescript-node/default/api/storeApi.ts @@ -39,8 +39,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/client/petstore/typescript-node/default/api/userApi.ts b/samples/client/petstore/typescript-node/default/api/userApi.ts index ff11964e439..fbeb9660bdf 100644 --- a/samples/client/petstore/typescript-node/default/api/userApi.ts +++ b/samples/client/petstore/typescript-node/default/api/userApi.ts @@ -39,8 +39,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/client/petstore/typescript-node/npm/api/petApi.ts b/samples/client/petstore/typescript-node/npm/api/petApi.ts index d518c2b66c8..f755d42f4da 100644 --- a/samples/client/petstore/typescript-node/npm/api/petApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/petApi.ts @@ -40,8 +40,8 @@ export class PetApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/client/petstore/typescript-node/npm/api/storeApi.ts b/samples/client/petstore/typescript-node/npm/api/storeApi.ts index 8cb4e74e842..f3f5b8ca651 100644 --- a/samples/client/petstore/typescript-node/npm/api/storeApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/storeApi.ts @@ -39,8 +39,8 @@ export class StoreApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/client/petstore/typescript-node/npm/api/userApi.ts b/samples/client/petstore/typescript-node/npm/api/userApi.ts index ff11964e439..fbeb9660bdf 100644 --- a/samples/client/petstore/typescript-node/npm/api/userApi.ts +++ b/samples/client/petstore/typescript-node/npm/api/userApi.ts @@ -39,8 +39,8 @@ export class UserApi { protected authentications = { 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), } protected interceptors: Interceptor[] = []; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index 0f37d116722..da100d49f50 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -162,6 +162,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -174,11 +183,11 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -## bearer_test +## http_basic_test - **Type**: HTTP basic authentication -## http_basic_test +## bearer_test - **Type**: HTTP basic authentication @@ -186,15 +195,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index 0f37d116722..da100d49f50 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -162,6 +162,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -174,11 +183,11 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -## bearer_test +## http_basic_test - **Type**: HTTP basic authentication -## http_basic_test +## bearer_test - **Type**: HTTP basic authentication @@ -186,15 +195,6 @@ Class | Method | HTTP request | Description - **Type**: HTTP basic authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - ## Author diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md index dd7e2f92353..3b1ff1eca35 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md @@ -95,12 +95,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -110,6 +104,12 @@ Class | Method | HTTP request | Description - **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 + ## Author diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index 989702d292d..ed181f1495b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -156,6 +156,15 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -168,26 +177,17 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string -## bearer_test - -- **Type**: HTTP Bearer authentication - ## http_basic_test - **Type**: HTTP Basic authentication +## bearer_test + +- **Type**: HTTP Bearer authentication + ## http_signature_test -## 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 - ## Author diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index 16700f869b2..5110c56c9e2 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -193,6 +193,36 @@ Class | Method | HTTP request | Description +### 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 + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. + +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + + ### api_key - **Type**: API key @@ -211,18 +241,6 @@ Note, each API key must be added to a map of `map[string]APIKey` where the key i Note, each API key must be added to a map of `map[string]APIKey` where the key is: api_key_query and passed in as the auth context for each request. -### bearer_test - -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) -``` - - ### http_basic_test - **Type**: HTTP basic authentication @@ -238,6 +256,18 @@ r, err := client.Service.Operation(auth, args) ``` +### bearer_test + +- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + ### http_signature_test - **Type**: HTTP signature authentication @@ -270,36 +300,6 @@ Example ``` -### 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 - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") -r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -```golang -import "golang.org/x/oauth2" - -/* Perform OAuth2 round trip request and obtain a token */ - -tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) -auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) -r, err := client.Service.Operation(auth, args) -``` - - ## Documentation for Utility Methods Due to the fact that model structure members are all pointers, this package contains diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md index b74cfc71f93..2ee4c306785 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md @@ -68,7 +68,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -204,7 +204,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -270,7 +270,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -404,7 +404,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/README.md b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/README.md index 12016d0528c..12f02de97e3 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/README.md @@ -177,13 +177,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization Authentication schemes defined for the API: -### api_key - - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -194,6 +187,13 @@ Authentication schemes defined for the API: - write:pets: modify pets in your account - read:pets: read your pets +### api_key + + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Recommendation diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java index 25a50c6bf66..f9ee6b3f184 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-swagger1/src/main/java/org/openapitools/client/ApiClient.java @@ -127,14 +127,6 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); Authentication auth = null; - if (authMap != null) { - auth = authMap.get("api_key"); - } - if (auth instanceof ApiKeyAuth) { - authentications.put("api_key", auth); - } else { - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - } if (authMap != null) { auth = authMap.get("petstore_auth"); } @@ -143,6 +135,14 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("petstore_auth", new OAuth(basePath, "")); } + if (authMap != null) { + auth = authMap.get("api_key"); + } + if (auth instanceof ApiKeyAuth) { + authentications.put("api_key", auth); + } else { + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + } // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 784f3ea2177..870b398e093 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -262,6 +262,16 @@ Class | Method | HTTP request | Description ## 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 @@ -276,12 +286,12 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string -### bearer_test +### http_basic_test - **Type**: HTTP basic authentication -### http_basic_test +### bearer_test - **Type**: HTTP basic authentication @@ -291,16 +301,6 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### petstore_auth - - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - ## Recommendation diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md index eb2957e4705..b6096623c13 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md @@ -40,11 +40,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -73,7 +73,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -181,11 +181,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List status = Arrays.asList("available"); // List | Status values that need to be considered for filter try { @@ -215,7 +215,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -253,11 +253,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); List tags = Arrays.asList(); // List | Tags to filter by try { @@ -287,7 +287,7 @@ public class Example { ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -399,11 +399,11 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); - // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + PetApi apiInstance = new PetApi(defaultClient); Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { @@ -432,7 +432,7 @@ null (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 76babaff4ac..af933ffdc90 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -197,6 +197,14 @@ public class ApiClient extends JavaTimeFormatter { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); Authentication auth = null; + if (authMap != null) { + auth = authMap.get("petstore_auth"); + } + if (auth instanceof OAuth) { + authentications.put("petstore_auth", auth); + } else { + authentications.put("petstore_auth", new OAuth(basePath, "")); + } if (authMap != null) { auth = authMap.get("api_key"); } @@ -213,14 +221,6 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); } - if (authMap != null) { - auth = authMap.get("bearer_test"); - } - if (auth instanceof HttpBearerAuth) { - authentications.put("bearer_test", auth); - } else { - authentications.put("bearer_test", new HttpBearerAuth("bearer")); - } if (authMap != null) { auth = authMap.get("http_basic_test"); } @@ -229,20 +229,20 @@ public class ApiClient extends JavaTimeFormatter { } else { authentications.put("http_basic_test", new HttpBasicAuth()); } + if (authMap != null) { + auth = authMap.get("bearer_test"); + } + if (auth instanceof HttpBearerAuth) { + authentications.put("bearer_test", auth); + } else { + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + } if (authMap != null) { auth = authMap.get("http_signature_test"); } if (auth instanceof HttpSignatureAuth) { authentications.put("http_signature_test", auth); } - if (authMap != null) { - auth = authMap.get("petstore_auth"); - } - if (auth instanceof OAuth) { - authentications.put("petstore_auth", auth); - } else { - authentications.put("petstore_auth", new OAuth(basePath, "")); - } // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index e6ec7cfd993..f985d589a3f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -105,7 +105,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, @@ -242,7 +242,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; GenericType> localVarReturnType = new GenericType>() {}; @@ -316,7 +316,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; GenericType> localVarReturnType = new GenericType>() {}; @@ -458,7 +458,7 @@ public class PetApi { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; + String[] localVarAuthNames = new String[] { "petstore_auth", "http_signature_test" }; return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, diff --git a/samples/openapi3/client/petstore/python-legacy/README.md b/samples/openapi3/client/petstore/python-legacy/README.md index a9af4fe48d2..bee1d84445e 100755 --- a/samples/openapi3/client/petstore/python-legacy/README.md +++ b/samples/openapi3/client/petstore/python-legacy/README.md @@ -179,6 +179,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -193,30 +203,20 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## bearer_test - -- **Type**: Bearer authentication (JWT) - - ## http_basic_test - **Type**: HTTP basic authentication +## bearer_test + +- **Type**: Bearer authentication (JWT) + + ## http_signature_test -## 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 - - ## Author diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/configuration.py index c0da3c63826..50ce149ab7d 100755 --- a/samples/openapi3/client/petstore/python-legacy/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/configuration.py @@ -460,6 +460,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -478,6 +485,13 @@ conf = petstore_api.Configuration( 'api_key_query', ), } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } if self.access_token is not None: auth['bearer_test'] = { 'type': 'bearer', @@ -486,13 +500,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': 'Bearer ' + self.access_token } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } if self.signing_info is not None: auth['http_signature_test'] = { 'type': 'http-signature', @@ -500,13 +507,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': None # Signature headers are calculated for every HTTP request } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md index aa2751c2aec..2a540aa293f 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md @@ -187,6 +187,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -201,30 +211,20 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## bearer_test - -- **Type**: Bearer authentication (JWT) - - ## http_basic_test - **Type**: HTTP basic authentication +## bearer_test + +- **Type**: Bearer authentication (JWT) + + ## http_signature_test -## 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 - - ## Author diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md index 210934aa009..efeab229b1b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/docs/PetApi.md @@ -24,99 +24,6 @@ Add a new pet to the store ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Add a new pet to the store - await api_instance.add_pet(pet) - except Exception as e: - print("Exception when calling PetApi->add_pet: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -136,6 +43,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -196,8 +105,99 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Add a new pet to the store + await api_instance.add_pet(pet) + except Exception as e: + print("Exception when calling PetApi->add_pet: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client async with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -223,7 +223,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -319,101 +319,6 @@ Multiple status values can be provided with comma separated strings ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - status = ['status_example'] # List[str] | Status values that need to be considered for filter - - try: - # Finds Pets by status - api_response = await api_instance.find_pets_by_status(status) - print("The response of PetApi->find_pets_by_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -433,6 +338,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -493,8 +400,101 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + status = ['status_example'] # List[str] | Status values that need to be considered for filter + + try: + # Finds Pets by status + api_response = await api_instance.find_pets_by_status(status) + print("The response of PetApi->find_pets_by_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client async with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -522,7 +522,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -546,101 +546,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - tags = ['tags_example'] # List[str] | Tags to filter by - - try: - # Finds Pets by tags - api_response = await api_instance.find_pets_by_tags(tags) - print("The response of PetApi->find_pets_by_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -660,6 +565,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -720,8 +627,101 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + tags = ['tags_example'] # List[str] | Tags to filter by + + try: + # Finds Pets by tags + api_response = await api_instance.find_pets_by_tags(tags) + print("The response of PetApi->find_pets_by_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client async with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -749,7 +749,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -850,99 +850,6 @@ Update an existing pet ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Update an existing pet - await api_instance.update_pet(pet) - except Exception as e: - print("Exception when calling PetApi->update_pet: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -962,6 +869,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -1022,8 +931,99 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Update an existing pet + await api_instance.update_pet(pet) + except Exception as e: + print("Exception when calling PetApi->update_pet: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client async with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -1049,7 +1049,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py index 06580cfe707..72bbd378d6d 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py @@ -166,7 +166,7 @@ class PetApi(object): _header_params['Content-Type'] = _content_types_list # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = {} @@ -452,7 +452,7 @@ class PetApi(object): ['application/xml', 'application/json']) # noqa: E501 # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = { '200': "List[Pet]", @@ -597,7 +597,7 @@ class PetApi(object): ['application/xml', 'application/json']) # noqa: E501 # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = { '200': "List[Pet]", @@ -889,7 +889,7 @@ class PetApi(object): _header_params['Content-Type'] = _content_types_list # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = {} diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/configuration.py index d0c210e5a9b..4dfb0965c3e 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/configuration.py @@ -435,6 +435,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -453,6 +460,13 @@ conf = petstore_api.Configuration( 'api_key_query', ), } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } if self.access_token is not None: auth['bearer_test'] = { 'type': 'bearer', @@ -461,13 +475,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': 'Bearer ' + self.access_token } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } if self.signing_info is not None: auth['http_signature_test'] = { 'type': 'http-signature', @@ -475,13 +482,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': None # Signature headers are calculated for every HTTP request } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/openapi3/client/petstore/python-nextgen/README.md b/samples/openapi3/client/petstore/python-nextgen/README.md index 80a7b39c45c..55b837e20cf 100755 --- a/samples/openapi3/client/petstore/python-nextgen/README.md +++ b/samples/openapi3/client/petstore/python-nextgen/README.md @@ -187,6 +187,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -201,30 +211,20 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## bearer_test - -- **Type**: Bearer authentication (JWT) - - ## http_basic_test - **Type**: HTTP basic authentication +## bearer_test + +- **Type**: Bearer authentication (JWT) + + ## http_signature_test -## 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 - - ## Author diff --git a/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md b/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md index f3a1d7446dc..5b395675ee6 100755 --- a/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-nextgen/docs/PetApi.md @@ -24,99 +24,6 @@ Add a new pet to the store ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Add a new pet to the store - api_instance.add_pet(pet) - except Exception as e: - print("Exception when calling PetApi->add_pet: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -136,6 +43,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -196,8 +105,99 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Add a new pet to the store + api_instance.add_pet(pet) + except Exception as e: + print("Exception when calling PetApi->add_pet: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -223,7 +223,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -319,101 +319,6 @@ Multiple status values can be provided with comma separated strings ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - status = ['status_example'] # List[str] | Status values that need to be considered for filter - - try: - # Finds Pets by status - api_response = api_instance.find_pets_by_status(status) - print("The response of PetApi->find_pets_by_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -433,6 +338,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -493,8 +400,101 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + status = ['status_example'] # List[str] | Status values that need to be considered for filter + + try: + # Finds Pets by status + api_response = api_instance.find_pets_by_status(status) + print("The response of PetApi->find_pets_by_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -522,7 +522,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -546,101 +546,6 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - tags = ['tags_example'] # List[str] | Tags to filter by - - try: - # Finds Pets by tags - api_response = api_instance.find_pets_by_tags(tags) - print("The response of PetApi->find_pets_by_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -660,6 +565,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -720,8 +627,101 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + tags = ['tags_example'] # List[str] | Tags to filter by + + try: + # Finds Pets by tags + api_response = api_instance.find_pets_by_tags(tags) + print("The response of PetApi->find_pets_by_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -749,7 +749,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -850,99 +850,6 @@ Update an existing pet ### Example -```python -from __future__ import print_function -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Update an existing pet - api_instance.update_pet(pet) - except Exception as e: - print("Exception when calling PetApi->update_pet: %s\n" % e) -``` - * OAuth Authentication (petstore_auth): ```python from __future__ import print_function @@ -962,6 +869,8 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +configuration.access_token = os.environ["ACCESS_TOKEN"] + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -1022,8 +931,99 @@ configuration = petstore_api.Configuration( ) ) +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Update an existing pet + api_instance.update_pet(pet) + except Exception as e: + print("Exception when calling PetApi->update_pet: %s\n" % e) +``` + +```python +from __future__ import print_function +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + configuration.access_token = os.environ["ACCESS_TOKEN"] +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -1049,7 +1049,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py index 06580cfe707..72bbd378d6d 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py @@ -166,7 +166,7 @@ class PetApi(object): _header_params['Content-Type'] = _content_types_list # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = {} @@ -452,7 +452,7 @@ class PetApi(object): ['application/xml', 'application/json']) # noqa: E501 # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = { '200': "List[Pet]", @@ -597,7 +597,7 @@ class PetApi(object): ['application/xml', 'application/json']) # noqa: E501 # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = { '200': "List[Pet]", @@ -889,7 +889,7 @@ class PetApi(object): _header_params['Content-Type'] = _content_types_list # authentication setting - _auth_settings = ['http_signature_test', 'petstore_auth'] # noqa: E501 + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 _response_types_map = {} diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/configuration.py index 72f32620259..cd8c9fafb0a 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/configuration.py @@ -439,6 +439,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -457,6 +464,13 @@ conf = petstore_api.Configuration( 'api_key_query', ), } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } if self.access_token is not None: auth['bearer_test'] = { 'type': 'bearer', @@ -465,13 +479,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': 'Bearer ' + self.access_token } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } if self.signing_info is not None: auth['http_signature_test'] = { 'type': 'http-signature', @@ -479,13 +486,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': None # Signature headers are calculated for every HTTP request } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/openapi3/client/petstore/python-prior/README.md b/samples/openapi3/client/petstore/python-prior/README.md index 0b59228e6f1..88cfa111d99 100644 --- a/samples/openapi3/client/petstore/python-prior/README.md +++ b/samples/openapi3/client/petstore/python-prior/README.md @@ -241,6 +241,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -255,31 +265,21 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## bearer_test - -- **Type**: Bearer authentication (JWT) - - ## http_basic_test - **Type**: HTTP basic authentication +## bearer_test + +- **Type**: Bearer authentication (JWT) + + ## http_signature_test - **Type**: HTTP signature authentication -## petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - ## Author diff --git a/samples/openapi3/client/petstore/python-prior/docs/PetApi.md b/samples/openapi3/client/petstore/python-prior/docs/PetApi.md index 381626e89de..f1ce099c8be 100644 --- a/samples/openapi3/client/petstore/python-prior/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-prior/docs/PetApi.md @@ -41,6 +41,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) +configuration.access_token = 'YOUR_ACCESS_TOKEN' + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -101,12 +107,6 @@ configuration = petstore_api.Configuration( ) ) -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -151,7 +151,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -281,6 +281,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) +configuration.access_token = 'YOUR_ACCESS_TOKEN' + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -341,12 +347,6 @@ configuration = petstore_api.Configuration( ) ) -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -377,7 +377,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -422,6 +422,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) +configuration.access_token = 'YOUR_ACCESS_TOKEN' + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -482,12 +488,6 @@ configuration = petstore_api.Configuration( ) ) -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -516,7 +516,7 @@ Name | Type | Description | Notes ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers @@ -641,6 +641,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) +configuration.access_token = 'YOUR_ACCESS_TOKEN' + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -701,12 +707,6 @@ configuration = petstore_api.Configuration( ) ) -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) -configuration.access_token = 'YOUR_ACCESS_TOKEN' - # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -751,7 +751,7 @@ void (empty response body) ### Authorization -[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/openapi3/client/petstore/python-prior/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-prior/petstore_api/api/pet_api.py index 562acfd4122..bbc8fd7ee4c 100644 --- a/samples/openapi3/client/petstore/python-prior/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-prior/petstore_api/api/pet_api.py @@ -39,8 +39,8 @@ class PetApi(object): settings={ 'response_type': None, 'auth': [ - 'http_signature_test', - 'petstore_auth' + 'petstore_auth', + 'http_signature_test' ], 'endpoint_path': '/pet', 'operation_id': 'add_pet', @@ -154,8 +154,8 @@ class PetApi(object): settings={ 'response_type': ([Pet],), 'auth': [ - 'http_signature_test', - 'petstore_auth' + 'petstore_auth', + 'http_signature_test' ], 'endpoint_path': '/pet/findByStatus', 'operation_id': 'find_pets_by_status', @@ -215,8 +215,8 @@ class PetApi(object): settings={ 'response_type': ([Pet],), 'auth': [ - 'http_signature_test', - 'petstore_auth' + 'petstore_auth', + 'http_signature_test' ], 'endpoint_path': '/pet/findByTags', 'operation_id': 'find_pets_by_tags', @@ -321,8 +321,8 @@ class PetApi(object): settings={ 'response_type': None, 'auth': [ - 'http_signature_test', - 'petstore_auth' + 'petstore_auth', + 'http_signature_test' ], 'endpoint_path': '/pet', 'operation_id': 'update_pet', diff --git a/samples/openapi3/client/petstore/python-prior/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-prior/petstore_api/configuration.py index 0c4db4c52af..3604fac37ce 100644 --- a/samples/openapi3/client/petstore/python-prior/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python-prior/petstore_api/configuration.py @@ -456,6 +456,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -474,6 +481,13 @@ conf = petstore_api.Configuration( 'api_key_query', ), } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } if self.access_token is not None: auth['bearer_test'] = { 'type': 'bearer', @@ -482,13 +496,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': 'Bearer ' + self.access_token } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } if self.signing_info is not None: auth['http_signature_test'] = { 'type': 'http-signature', @@ -496,13 +503,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': None # Signature headers are calculated for every HTTP request } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 152d38ce006..b16c776babe 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -357,6 +357,16 @@ Class | Method | HTTP request | Description ## Documentation For Authorization +## 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 @@ -371,30 +381,20 @@ Class | Method | HTTP request | Description - **Location**: URL query string -## bearer_test - -- **Type**: Bearer authentication (JWT) - - ## http_basic_test - **Type**: HTTP basic authentication +## bearer_test + +- **Type**: Bearer authentication (JWT) + + Authentication schemes defined for the API: ## http_signature_test - **Type**: HTTP signature authentication - 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 - ## Author diff --git a/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md b/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md index 28787e08d35..be45f7cddb0 100644 --- a/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md +++ b/samples/openapi3/client/petstore/python/docs/apis/tags/PetApi.md @@ -42,6 +42,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + access_token = 'YOUR_ACCESS_TOKEN' +) + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -101,12 +107,6 @@ configuration = petstore_api.Configuration( signature_max_validity = datetime.timedelta(minutes=5) ) ) - -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - access_token = 'YOUR_ACCESS_TOKEN' -) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -188,7 +188,7 @@ headers | Unset | headers were not defined | ### Authorization -[http_signature_test](../../../README.md#http_signature_test), [petstore_auth](../../../README.md#petstore_auth) +[petstore_auth](../../../README.md#petstore_auth), [http_signature_test](../../../README.md#http_signature_test) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) @@ -342,6 +342,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + access_token = 'YOUR_ACCESS_TOKEN' +) + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -401,12 +407,6 @@ configuration = petstore_api.Configuration( signature_max_validity = datetime.timedelta(minutes=5) ) ) - -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - access_token = 'YOUR_ACCESS_TOKEN' -) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -505,7 +505,7 @@ headers | Unset | headers were not defined | ### Authorization -[http_signature_test](../../../README.md#http_signature_test), [petstore_auth](../../../README.md#petstore_auth) +[petstore_auth](../../../README.md#petstore_auth), [http_signature_test](../../../README.md#http_signature_test) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) @@ -536,6 +536,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + access_token = 'YOUR_ACCESS_TOKEN' +) + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -595,12 +601,6 @@ configuration = petstore_api.Configuration( signature_max_validity = datetime.timedelta(minutes=5) ) ) - -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - access_token = 'YOUR_ACCESS_TOKEN' -) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -699,7 +699,7 @@ headers | Unset | headers were not defined | ### Authorization -[http_signature_test](../../../README.md#http_signature_test), [petstore_auth](../../../README.md#petstore_auth) +[petstore_auth](../../../README.md#petstore_auth), [http_signature_test](../../../README.md#http_signature_test) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) @@ -850,6 +850,12 @@ configuration = petstore_api.Configuration( # Examples for each auth method are provided below, use the example that # satisfies your auth use case. +# Configure OAuth2 access token for authorization: petstore_auth +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + access_token = 'YOUR_ACCESS_TOKEN' +) + # Configure HTTP message signature: http_signature_test # The HTTP Signature Header mechanism that can be used by a client to # authenticate the sender of a message and ensure that particular headers @@ -909,12 +915,6 @@ configuration = petstore_api.Configuration( signature_max_validity = datetime.timedelta(minutes=5) ) ) - -# Configure OAuth2 access token for authorization: petstore_auth -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - access_token = 'YOUR_ACCESS_TOKEN' -) # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class @@ -1004,7 +1004,7 @@ headers | Unset | headers were not defined | ### Authorization -[http_signature_test](../../../README.md#http_signature_test), [petstore_auth](../../../README.md#petstore_auth) +[petstore_auth](../../../README.md#petstore_auth), [http_signature_test](../../../README.md#http_signature_test) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index e783d4cf3ce..6e387b9c1e3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -460,6 +460,13 @@ conf = petstore_api.Configuration( :return: The Auth Settings information dict. """ auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } if 'api_key' in self.api_key: auth['api_key'] = { 'type': 'api_key', @@ -478,6 +485,13 @@ conf = petstore_api.Configuration( 'api_key_query', ), } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } if self.access_token is not None: auth['bearer_test'] = { 'type': 'bearer', @@ -486,13 +500,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': 'Bearer ' + self.access_token } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } if self.signing_info is not None: auth['http_signature_test'] = { 'type': 'http-signature', @@ -500,13 +507,6 @@ conf = petstore_api.Configuration( 'key': 'Authorization', 'value': None # Signature headers are calculated for every HTTP request } - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } return auth def to_debug_report(self): diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py index 8e267ad6491..0bad1ac3eac 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/post.py @@ -44,8 +44,8 @@ request_body_pet = api_client.RequestBody( required=True, ) _auth = [ - 'http_signature_test', 'petstore_auth', + 'http_signature_test', ] _servers = ( { diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py index 59a92186bfa..c700a477c00 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet/put.py @@ -44,8 +44,8 @@ request_body_pet = api_client.RequestBody( required=True, ) _auth = [ - 'http_signature_test', 'petstore_auth', + 'http_signature_test', ] _servers = ( { diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get.py index c88c43fdb22..4e9d9acf765 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get.py +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_status/get.py @@ -103,8 +103,8 @@ request_query_status = api_client.QueryParameter( required=True, ) _auth = [ - 'http_signature_test', 'petstore_auth', + 'http_signature_test', ] diff --git a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get.py b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get.py index dcc3db50dcd..fd4e8cceae2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get.py +++ b/samples/openapi3/client/petstore/python/petstore_api/paths/pet_find_by_tags/get.py @@ -78,8 +78,8 @@ request_query_tags = api_client.QueryParameter( required=True, ) _auth = [ - 'http_signature_test', 'petstore_auth', + 'http_signature_test', ] diff --git a/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/openapi3/client/petstore/spring-cloud-async/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java index 4a28661290d..49f1c66c11a 100644 --- a/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java +++ b/samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/configuration/ClientConfiguration.java @@ -15,15 +15,6 @@ import org.springframework.security.oauth2.client.token.grant.implicit.ImplicitR @EnableConfigurationProperties public class ClientConfiguration { - @Value("${openapipetstore.security.apiKey.key:}") - private String apiKeyKey; - - @Bean - @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") - public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { - return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); - } - @Bean @ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id") public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor(OAuth2ClientContext oAuth2ClientContext) { @@ -45,4 +36,13 @@ public class ClientConfiguration { return details; } + @Value("${openapipetstore.security.apiKey.key:}") + private String apiKeyKey; + + @Bean + @ConditionalOnProperty(name = "openapipetstore.security.apiKey.key") + public ApiKeyRequestInterceptor apiKeyRequestInterceptor() { + return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey); + } + } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts index 7c393656367..4b9e37aa257 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/auth/auth.ts @@ -21,26 +21,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -61,11 +41,31 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { "default"?: SecurityAuthentication, - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -75,8 +75,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -91,17 +91,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts index 7c393656367..4b9e37aa257 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/auth/auth.ts @@ -21,26 +21,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -61,11 +41,31 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { "default"?: SecurityAuthentication, - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -75,8 +75,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -91,17 +91,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts index 2f891fb94ea..16916994204 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/auth/auth.ts @@ -21,26 +21,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -61,11 +41,31 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { "default"?: SecurityAuthentication, - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -75,8 +75,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -91,17 +91,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts index dec531ac42e..a351e58d5e5 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/auth/auth.ts @@ -27,27 +27,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -@injectable() -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(@inject(AuthApiKey) @named("api_key") private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -69,15 +48,36 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +@injectable() +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(@inject(AuthApiKey) @named("api_key") private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export const authMethodServices = { - "api_key": ApiKeyAuthentication, - "petstore_auth": PetstoreAuthAuthentication + "petstore_auth": PetstoreAuthAuthentication, + "api_key": ApiKeyAuthentication } export type ApiKeyConfiguration = string; @@ -86,8 +86,8 @@ export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -101,17 +101,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine return authMethods; } - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts index 7c393656367..4b9e37aa257 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/auth/auth.ts @@ -21,26 +21,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -61,11 +41,31 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { "default"?: SecurityAuthentication, - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -75,8 +75,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -91,17 +91,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/auth/auth.ts index 7c393656367..4b9e37aa257 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/auth/auth.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/auth/auth.ts @@ -21,26 +21,6 @@ export interface TokenProvider { getToken(): Promise | string; } -/** - * Applies apiKey authentication to the request context. - */ -export class ApiKeyAuthentication implements SecurityAuthentication { - /** - * Configures this api key authentication with the necessary properties - * - * @param apiKey: The api key to be used for every request - */ - public constructor(private apiKey: string) {} - - public getName(): string { - return "api_key"; - } - - public applySecurityAuthentication(context: RequestContext) { - context.setHeaderParam("api_key", this.apiKey); - } -} - /** * Applies oauth2 authentication to the request context. */ @@ -61,11 +41,31 @@ export class PetstoreAuthAuthentication implements SecurityAuthentication { } } +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + export type AuthMethods = { "default"?: SecurityAuthentication, - "api_key"?: SecurityAuthentication, - "petstore_auth"?: SecurityAuthentication + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication } export type ApiKeyConfiguration = string; @@ -75,8 +75,8 @@ export type OAuth2Configuration = { accessToken: string }; export type AuthMethodsConfiguration = { "default"?: SecurityAuthentication, - "api_key"?: ApiKeyConfiguration, - "petstore_auth"?: OAuth2Configuration + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration } /** @@ -91,17 +91,17 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine } authMethods["default"] = config["default"] - if (config["api_key"]) { - authMethods["api_key"] = new ApiKeyAuthentication( - config["api_key"] - ); - } - if (config["petstore_auth"]) { authMethods["petstore_auth"] = new PetstoreAuthAuthentication( config["petstore_auth"]["accessToken"] ); } + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + return authMethods; } \ No newline at end of file diff --git a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index ea662c09482..2ea502c445a 100644 --- a/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/spring-boot-springdoc/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,14 +29,14 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) .name("api_key") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index ea662c09482..2ea502c445a 100644 --- a/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot-3/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,14 +29,14 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) .name("api_key") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index 6001110b504..a32f1f67787 100644 --- a/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,6 +29,9 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) @@ -43,9 +46,6 @@ public class SpringDocConfiguration { .type(SecurityScheme.Type.HTTP) .scheme("basic") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index 6001110b504..a32f1f67787 100644 --- a/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,6 +29,9 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) @@ -43,9 +46,6 @@ public class SpringDocConfiguration { .type(SecurityScheme.Type.HTTP) .scheme("basic") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index 6001110b504..a32f1f67787 100644 --- a/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,6 +29,9 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) @@ -43,9 +46,6 @@ public class SpringDocConfiguration { .type(SecurityScheme.Type.HTTP) .scheme("basic") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index 6001110b504..a32f1f67787 100644 --- a/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot-useoptional/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,6 +29,9 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) @@ -43,9 +46,6 @@ public class SpringDocConfiguration { .type(SecurityScheme.Type.HTTP) .scheme("basic") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index ea662c09482..2ea502c445a 100644 --- a/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,14 +29,14 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) .name("api_key") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; } diff --git a/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl b/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl index 1a36f0a40f4..817c1a49a83 100644 --- a/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl +++ b/samples/server/petstore/erlang-server/src/openapi_logic_handler.erl @@ -1,7 +1,6 @@ -module(openapi_logic_handler). -export([handle_request/4]). --export([authorize_api_key/3]). -type context() :: #{binary() => any()}. -type handler_response() ::{ Status :: cowboy:http_status(), diff --git a/samples/server/petstore/kotlin-server-modelMutable/README.md b/samples/server/petstore/kotlin-server-modelMutable/README.md index 5479ab606f4..d18c85c01a3 100644 --- a/samples/server/petstore/kotlin-server-modelMutable/README.md +++ b/samples/server/petstore/kotlin-server-modelMutable/README.md @@ -85,13 +85,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -102,3 +95,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/AppMain.kt b/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/AppMain.kt index 9b0468fb568..3244ed0ba8c 100644 --- a/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/AppMain.kt +++ b/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/AppMain.kt @@ -47,6 +47,14 @@ fun Application.main() { install(HSTS, ApplicationHstsConfiguration()) // see https://ktor.io/docs/hsts.html install(Locations) // see https://ktor.io/docs/features-locations.html install(Authentication) { + oauth("petstore_auth") { + client = HttpClient(Apache) + providerLookup = { ApplicationAuthProviders["petstore_auth"] } + urlProvider = { _ -> + // TODO: define a callback url here. + "/" + } + } // "Implement API key auth (api_key) for parameter name 'api_key'." apiKeyAuth("api_key") { validate { apikeyCredential: ApiKeyCredential -> @@ -56,14 +64,6 @@ fun Application.main() { } } } - oauth("petstore_auth") { - client = HttpClient(Apache) - providerLookup = { ApplicationAuthProviders["petstore_auth"] } - urlProvider = { _ -> - // TODO: define a callback url here. - "/" - } - } } install(Routing) { PetApi() diff --git a/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/Configuration.kt b/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/Configuration.kt index 93aa1c72822..604eb33677b 100644 --- a/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/Configuration.kt +++ b/samples/server/petstore/kotlin-server-modelMutable/src/main/kotlin/org/openapitools/server/Configuration.kt @@ -57,7 +57,7 @@ val ApplicationAuthProviders: Map = listOf ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -87,3 +80,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/server/petstore/kotlin-server/ktor/README.md b/samples/server/petstore/kotlin-server/ktor/README.md index 5479ab606f4..d18c85c01a3 100644 --- a/samples/server/petstore/kotlin-server/ktor/README.md +++ b/samples/server/petstore/kotlin-server/ktor/README.md @@ -85,13 +85,6 @@ Class | Method | HTTP request | Description ## Documentation for Authorization - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ### petstore_auth @@ -102,3 +95,10 @@ Class | Method | HTTP request | Description - 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 + diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt index 9b0468fb568..3244ed0ba8c 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt @@ -47,6 +47,14 @@ fun Application.main() { install(HSTS, ApplicationHstsConfiguration()) // see https://ktor.io/docs/hsts.html install(Locations) // see https://ktor.io/docs/features-locations.html install(Authentication) { + oauth("petstore_auth") { + client = HttpClient(Apache) + providerLookup = { ApplicationAuthProviders["petstore_auth"] } + urlProvider = { _ -> + // TODO: define a callback url here. + "/" + } + } // "Implement API key auth (api_key) for parameter name 'api_key'." apiKeyAuth("api_key") { validate { apikeyCredential: ApiKeyCredential -> @@ -56,14 +64,6 @@ fun Application.main() { } } } - oauth("petstore_auth") { - client = HttpClient(Apache) - providerLookup = { ApplicationAuthProviders["petstore_auth"] } - urlProvider = { _ -> - // TODO: define a callback url here. - "/" - } - } } install(Routing) { PetApi() diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Configuration.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Configuration.kt index 93aa1c72822..604eb33677b 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Configuration.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Configuration.kt @@ -57,7 +57,7 @@ val ApplicationAuthProviders: Map = listOf ## Documentation for Authorization - - ### api_key - - - **Type**: API key - - **API key parameter name**: api_key - - **Location**: HTTP header - ### petstore_auth @@ -79,3 +72,10 @@ This runs all tests and packages the library. - 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 + diff --git a/samples/server/petstore/kotlin/vertx/README.md b/samples/server/petstore/kotlin/vertx/README.md index 47e035f66db..b06b4181852 100644 --- a/samples/server/petstore/kotlin/vertx/README.md +++ b/samples/server/petstore/kotlin/vertx/README.md @@ -62,13 +62,6 @@ This runs all tests and packages the library. ## Documentation for Authorization - - ### api_key - - - **Type**: API key - - **API key parameter name**: api_key - - **Location**: HTTP header - ### petstore_auth @@ -79,3 +72,10 @@ This runs all tests and packages the library. - 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 + diff --git a/samples/server/petstore/php-slim4/README.md b/samples/server/petstore/php-slim4/README.md index 14051a23046..e5dc584f80c 100644 --- a/samples/server/petstore/php-slim4/README.md +++ b/samples/server/petstore/php-slim4/README.md @@ -186,9 +186,6 @@ Class | Method | HTTP request | Description ## Authentication -### Security schema `api_key` -> Important! To make ApiKey authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class. - ### Security schema `petstore_auth` > Important! To make OAuth authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\OAuthAuthenticator](./src/Auth/OAuthAuthenticator.php) class. @@ -196,5 +193,8 @@ Scope list: * `write:pets` - modify pets in your account * `read:pets` - read your pets +### Security schema `api_key` +> Important! To make ApiKey authentication work you need to extend [\OpenAPIServer\Auth\AbstractAuthenticator](./lib/Auth/AbstractAuthenticator.php) class by [\OpenAPIServer\Auth\ApiKeyAuthenticator](./src/Auth/ApiKeyAuthenticator.php) class. + ### Advanced middleware configuration Ref to used Slim Token Middleware [dyorg/slim-token-authentication](https://github.com/dyorg/slim-token-authentication/tree/1.x#readme) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/README.md b/samples/server/petstore/php-symfony/SymfonyBundle-php/README.md index f4e197abe1d..949ff0b7a2d 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/README.md +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/README.md @@ -153,12 +153,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -168,6 +162,12 @@ Class | Method | HTTP request | Description - **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 + ## Author diff --git a/samples/server/petstore/python-aiohttp-srclayout/src/openapi_server/controllers/security_controller_.py b/samples/server/petstore/python-aiohttp-srclayout/src/openapi_server/controllers/security_controller_.py index b9a824bd558..82a8ffedab3 100644 --- a/samples/server/petstore/python-aiohttp-srclayout/src/openapi_server/controllers/security_controller_.py +++ b/samples/server/petstore/python-aiohttp-srclayout/src/openapi_server/controllers/security_controller_.py @@ -1,16 +1,6 @@ from typing import List -def info_from_api_key(api_key: str, required_scopes: None) -> dict: - """ - Check and retrieve authentication information from api_key. - Returned value will be passed in 'token_info' parameter of your operation function, if there is one. - 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. - Should return None if api_key is invalid or does not allow access to called API. - """ - return {'uid': 'user_id'} - - def info_from_petstore_auth(token: str) -> dict: """ Validate and decode token. @@ -26,3 +16,13 @@ def validate_scope_petstore_auth(required_scopes: List[str], token_scopes: List[ """ Validate required scopes are included in token scope """ return set(required_scopes).issubset(set(token_scopes)) + +def info_from_api_key(api_key: str, required_scopes: None) -> dict: + """ + Check and retrieve authentication information from api_key. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + Should return None if api_key is invalid or does not allow access to called API. + """ + return {'uid': 'user_id'} + diff --git a/samples/server/petstore/python-aiohttp/openapi_server/controllers/security_controller_.py b/samples/server/petstore/python-aiohttp/openapi_server/controllers/security_controller_.py index b9a824bd558..82a8ffedab3 100644 --- a/samples/server/petstore/python-aiohttp/openapi_server/controllers/security_controller_.py +++ b/samples/server/petstore/python-aiohttp/openapi_server/controllers/security_controller_.py @@ -1,16 +1,6 @@ from typing import List -def info_from_api_key(api_key: str, required_scopes: None) -> dict: - """ - Check and retrieve authentication information from api_key. - Returned value will be passed in 'token_info' parameter of your operation function, if there is one. - 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. - Should return None if api_key is invalid or does not allow access to called API. - """ - return {'uid': 'user_id'} - - def info_from_petstore_auth(token: str) -> dict: """ Validate and decode token. @@ -26,3 +16,13 @@ def validate_scope_petstore_auth(required_scopes: List[str], token_scopes: List[ """ Validate required scopes are included in token scope """ return set(required_scopes).issubset(set(token_scopes)) + +def info_from_api_key(api_key: str, required_scopes: None) -> dict: + """ + Check and retrieve authentication information from api_key. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + Should return None if api_key is invalid or does not allow access to called API. + """ + return {'uid': 'user_id'} + diff --git a/samples/server/petstore/python-fastapi/src/openapi_server/security_api.py b/samples/server/petstore/python-fastapi/src/openapi_server/security_api.py index 38eb60eb167..d216ee4271e 100644 --- a/samples/server/petstore/python-fastapi/src/openapi_server/security_api.py +++ b/samples/server/petstore/python-fastapi/src/openapi_server/security_api.py @@ -18,25 +18,6 @@ from fastapi.security.api_key import APIKeyCookie, APIKeyHeader, APIKeyQuery # from openapi_server.models.extra_models import TokenModel - -def get_token_api_key( - token_api_key_header: str = Security( - APIKeyHeader(name="api_key", auto_error=False) - ), -) -> TokenModel: - """ - Check and retrieve authentication information from api_key. - - :param token_api_key_header API key provided by Authorization[api_key] header - - - :type token_api_key_header: str - :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API - :rtype: TokenModel | None - """ - - ... - oauth2_implicit = OAuth2( flows=OAuthFlows( implicit=OAuthFlowImplicit( @@ -81,3 +62,22 @@ def validate_scope_petstore_auth( return False + +def get_token_api_key( + token_api_key_header: str = Security( + APIKeyHeader(name="api_key", auto_error=False) + ), +) -> TokenModel: + """ + Check and retrieve authentication information from api_key. + + :param token_api_key_header API key provided by Authorization[api_key] header + + + :type token_api_key_header: str + :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API + :rtype: TokenModel | None + """ + + ... + diff --git a/samples/server/petstore/python-flask/openapi_server/controllers/security_controller_.py b/samples/server/petstore/python-flask/openapi_server/controllers/security_controller_.py index 085d0180bc5..aae1a19e84a 100644 --- a/samples/server/petstore/python-flask/openapi_server/controllers/security_controller_.py +++ b/samples/server/petstore/python-flask/openapi_server/controllers/security_controller_.py @@ -1,22 +1,6 @@ from typing import List -def info_from_api_key(api_key, required_scopes): - """ - Check and retrieve authentication information from api_key. - Returned value will be passed in 'token_info' parameter of your operation function, if there is one. - 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. - - :param api_key API key provided by Authorization header - :type api_key: str - :param required_scopes Always None. Used for other authentication method - :type required_scopes: None - :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API - :rtype: dict | None - """ - return {'uid': 'user_id'} - - def info_from_petstore_auth(token): """ Validate and decode token. @@ -45,3 +29,19 @@ def validate_scope_petstore_auth(required_scopes, token_scopes): """ return set(required_scopes).issubset(set(token_scopes)) + +def info_from_api_key(api_key, required_scopes): + """ + Check and retrieve authentication information from api_key. + Returned value will be passed in 'token_info' parameter of your operation function, if there is one. + 'sub' or 'uid' will be set in 'user' parameter of your operation function, if there is one. + + :param api_key API key provided by Authorization header + :type api_key: str + :param required_scopes Always None. Used for other authentication method + :type required_scopes: None + :return: Information attached to provided api_key or None if api_key is invalid or does not allow access to called API + :rtype: dict | None + """ + return {'uid': 'user_id'} + diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md index 6f583383df7..3a616bca308 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -202,6 +202,21 @@ Method | HTTP request | Description ## Documentation For Authorization +## 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 + +Example +``` +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. +``` +``` ## api_key - **Type**: API key @@ -220,21 +235,6 @@ Example Example ``` ``` -## 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 - -Example -``` -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. -``` -``` ## Author diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/context.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/context.rs index dc28f08c1cf..b901da55ffc 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/context.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/context.rs @@ -104,6 +104,17 @@ impl Service> for AddContext(headers) { + let auth_data = AuthData::Bearer(bearer); + let context = context.push(Some(auth_data)); + let context = context.push(None::); + + return self.inner.call((request, context)) + } + } { use swagger::auth::api_key_from_header; @@ -139,17 +150,6 @@ impl Service> for AddContext(headers) { - let auth_data = AuthData::Bearer(bearer); - let context = context.push(Some(auth_data)); - let context = context.push(None::); - - return self.inner.call((request, context)) - } - } let context = context.push(None::); let context = context.push(None::); diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java index 6001110b504..a32f1f67787 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/SpringDocConfiguration.java @@ -29,6 +29,9 @@ public class SpringDocConfiguration { ) .components( new Components() + .addSecuritySchemes("petstore_auth", new SecurityScheme() + .type(SecurityScheme.Type.OAUTH2) + ) .addSecuritySchemes("api_key", new SecurityScheme() .type(SecurityScheme.Type.APIKEY) .in(SecurityScheme.In.HEADER) @@ -43,9 +46,6 @@ public class SpringDocConfiguration { .type(SecurityScheme.Type.HTTP) .scheme("basic") ) - .addSecuritySchemes("petstore_auth", new SecurityScheme() - .type(SecurityScheme.Type.OAUTH2) - ) ) ; }