[swift5] fix generation of multiple security definitions (#13617)

* uses correct variable to check for security definitions

* update samples
This commit is contained in:
Jonas Reichert
2022-10-07 17:01:35 +02:00
committed by GitHub
parent 038fe790dc
commit 6f3c0a8b5b
26 changed files with 50 additions and 13 deletions

View File

@@ -466,7 +466,7 @@ extension {{projectName}}API {
let localVariableRequestBuilder: RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = {{projectName}}API.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}} let localVariableRequestBuilder: RequestBuilder<{{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.Type = {{projectName}}API.requestBuilderFactory.{{#returnType}}getBuilder(){{/returnType}}{{^returnType}}getNonDecodableBuilder(){{/returnType}}
return localVariableRequestBuilder.init(method: "{{httpMethod}}", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: {{#authMethods}}true{{/authMethods}}{{^authMethods}}false{{/authMethods}}) return localVariableRequestBuilder.init(method: "{{httpMethod}}", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}})
} }
{{/useVapor}} {{/useVapor}}
{{/operation}} {{/operation}}

View File

@@ -45,6 +45,7 @@ paths:
- petstore_auth: - petstore_auth:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
- api_key_query: []
put: put:
tags: tags:
- pet - pet

View File

@@ -34,6 +34,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -46,6 +46,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -45,6 +45,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ internal class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ import AnyCodable
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -35,6 +35,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -51,7 +51,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -41,6 +41,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -44,7 +44,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -37,6 +37,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers

View File

@@ -34,6 +34,9 @@ open class PetAPI {
/** /**
Add a new pet to the store Add a new pet to the store
- POST /pet - POST /pet
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- OAuth: - OAuth:
- type: oauth2 - type: oauth2
- name: petstore_auth - name: petstore_auth

View File

@@ -54,7 +54,7 @@ Void (empty response body)
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth) [api_key_query](../README.md#api_key_query), [petstore_auth](../README.md#petstore_auth)
### HTTP request headers ### HTTP request headers