Description
If all auth methods maps to null, so ApiClient does not add them, the generated ApiClient will not compile:
authNames.forEach { authName ->
val auth =
when (authName) {
"openId" -> null
else -> throw RuntimeException("auth name $authName not found in available auth names")
}
if (auth != null) {
addAuthorization(authName, auth) // Smart cast to 'Nothing' is impossible, because 'auth' is a complex expression
}
}
openapi-generator version
7.0.1
OpenAPI declaration file content or url
components:
securitySchemes:
openId:
type: openIdConnect
openIdConnectUrl: "???"
Suggest a fix
An easy fix would be to explicitly specify the type of auth variable. This is unnecessary if we have handled auths, bot does not cause any issues either way:
authNames.forEach { authName ->
val auth: Interceptor? =
when (authName) {
"openId" -> null
else -> throw RuntimeException("auth name $authName not found in available auth names")
}
if (auth != null) {
addAuthorization(authName, auth) // Smart cast to 'Nothing' is impossible, because 'auth' is a complex expression
}
}
I would happily contribute this, if accepted.
Description
If all auth methods maps to null, so ApiClient does not add them, the generated ApiClient will not compile:
authNames.forEach { authName -> val auth = when (authName) { "openId" -> null else -> throw RuntimeException("auth name $authName not found in available auth names") } if (auth != null) { addAuthorization(authName, auth) // Smart cast to 'Nothing' is impossible, because 'auth' is a complex expression } }openapi-generator version
7.0.1
OpenAPI declaration file content or url
Suggest a fix
An easy fix would be to explicitly specify the type of
authvariable. This is unnecessary if we have handled auths, bot does not cause any issues either way:authNames.forEach { authName -> val auth: Interceptor? = when (authName) { "openId" -> null else -> throw RuntimeException("auth name $authName not found in available auth names") } if (auth != null) { addAuthorization(authName, auth) // Smart cast to 'Nothing' is impossible, because 'auth' is a complex expression } }I would happily contribute this, if accepted.