Skip to content

Commit

Permalink
Generate ApiKeyAuth with an apiKey security scheme (#10708)
Browse files Browse the repository at this point in the history
  • Loading branch information
NightEule5 authored Nov 2, 2021
1 parent 57afa97 commit 60bc508
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,18 @@ public void processOpts() {
}

if (usesRetrofit2Library()) {
if (ProcessUtils.hasOAuthMethods(openAPI)) {
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.kt.mustache", authFolder, "ApiKeyAuth.kt"));
boolean hasOAuthMethods = ProcessUtils.hasOAuthMethods(openAPI);

if (hasOAuthMethods) {
supportingFiles.add(new SupportingFile("auth/OAuth.kt.mustache", authFolder, "OAuth.kt"));
supportingFiles.add(new SupportingFile("auth/OAuthFlow.kt.mustache", authFolder, "OAuthFlow.kt"));
supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.kt.mustache", authFolder, "OAuthOkHttpClient.kt"));
}

if (hasOAuthMethods || ProcessUtils.hasApiKeyMethods(openAPI)) {
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.kt.mustache", authFolder, "ApiKeyAuth.kt"));
}

if (ProcessUtils.hasHttpBearerMethods(openAPI)) {
supportingFiles.add(new SupportingFile("auth/HttpBearerAuth.kt.mustache", authFolder, "HttpBearerAuth.kt"));
}
Expand Down

0 comments on commit 60bc508

Please sign in to comment.