forked from loafle/openapi-generator-original
[Java] [Kotlin] ignore unsupported schemes instead of throwing exception (#15817)
This commit is contained in:
@@ -57,7 +57,7 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
RequestInterceptor auth;
|
||||
RequestInterceptor auth = null;
|
||||
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)) {
|
||||
@@ -69,7 +69,9 @@ public class ApiClient {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
RequestInterceptor auth;
|
||||
RequestInterceptor auth = null;
|
||||
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)) {
|
||||
@@ -70,11 +70,12 @@ public class ApiClient {
|
||||
} else if ("bearer_test".equals(authName)) {
|
||||
auth = new HttpBearerAuth("bearer");
|
||||
} else if ("http_signature_test".equals(authName)) {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,25 +52,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
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)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,25 +53,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
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)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,25 +53,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
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)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user