Skip to content

Commit eb1e0b5

Browse files
committed
Merge pull request #1408 from kkrauth/patch-1
Fix syntax issue when no auth methods defined
2 parents d7b4f58 + 9ac9802 commit eb1e0b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ public class ApiClient {
4949
for(String authName : authNames) {
5050
if (apiAuthorizations.containsKey(authName)) {
5151
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
52-
}
53-
Interceptor auth;{{#authMethods}}
52+
}{{#authMethods}}
53+
Interceptor auth;
5454
if (authName == "{{name}}") { {{#isBasic}}
5555
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
5656
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
5757
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{^-first}}, {{/-first}}{{this}}{{/scopes}}");{{/isOAuth}}
58-
} else {{/authMethods}}{
58+
} else {
5959
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
6060
}
61-
apiAuthorizations.put(authName, auth);
61+
apiAuthorizations.put(authName, auth);{{/authMethods}}
6262
}
6363
addAuthsToOkClient(okClient);
6464
}

0 commit comments

Comments
 (0)