forked from loafle/openapi-generator-original
[kotlin][client] Fix compilation error when all auth method is mapped to null (#16861)
This commit is contained in:
parent
cb85358aa5
commit
0aff1a6504
@ -132,7 +132,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
|||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
|
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
val auth = when (authName) { {{#authMethods}}
|
val auth: Interceptor? = when (authName) { {{#authMethods}}
|
||||||
{{#isBasicBasic}}"{{name}}" -> HttpBasicAuth()
|
{{#isBasicBasic}}"{{name}}" -> HttpBasicAuth()
|
||||||
{{/isBasicBasic}}{{#isBasicBearer}}"{{name}}" -> HttpBearerAuth("{{scheme}}")
|
{{/isBasicBasic}}{{#isBasicBearer}}"{{name}}" -> HttpBearerAuth("{{scheme}}")
|
||||||
{{/isBasicBearer}}{{#isApiKey}}"{{name}}" -> ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}")
|
{{/isBasicBearer}}{{#isApiKey}}"{{name}}" -> ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}")
|
||||||
|
@ -70,7 +70,7 @@ class ApiClient(
|
|||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
val auth = when (authName) {
|
val auth: Interceptor? = when (authName) {
|
||||||
"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")
|
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||||
|
@ -72,7 +72,7 @@ class ApiClient(
|
|||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder) {
|
) : this(baseUrl, okHttpClientBuilder) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
val auth = when (authName) {
|
val auth: Interceptor? = when (authName) {
|
||||||
"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")
|
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||||
|
@ -74,7 +74,7 @@ class ApiClient(
|
|||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
val auth = when (authName) {
|
val auth: Interceptor? = when (authName) {
|
||||||
"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")
|
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||||
|
@ -72,7 +72,7 @@ class ApiClient(
|
|||||||
authNames: Array<String>
|
authNames: Array<String>
|
||||||
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||||
authNames.forEach { authName ->
|
authNames.forEach { authName ->
|
||||||
val auth = when (authName) {
|
val auth: Interceptor? = when (authName) {
|
||||||
"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")
|
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user