Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix syntax error on authMethods in java retrofit client #1444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
wing328 merged 3 commits into swagger-api:master from xhh:retrofit-syntex-error
Oct 27, 2015
Merged

Fix syntax error on authMethods in java retrofit client #1444

wing328 merged 3 commits into swagger-api:master from xhh:retrofit-syntex-error
Oct 27, 2015

Conversation

@xhh
Copy link
Contributor

@xhh xhh commented Oct 27, 2015

For example, the following Petstore code generated with the latest master does not compile:

for(String authName : authNames) {
 if (apiAuthorizations.containsKey(authName)) {
 throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
 }
 Interceptor auth;
 if (authName == "petstore_auth") { 
 auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
 } else {
 throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
 }
 apiAuthorizations.put(authName, auth);
 Interceptor auth;
 if (authName == "api_key") { 
 auth = new ApiKeyAuth("header", "api_key");
 } else {
 throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
 }
 apiAuthorizations.put(authName, auth);
}

This PR changes it to:

for(String authName : authNames) {
 if (apiAuthorizations.containsKey(authName)) {
 throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
 }
 Interceptor auth;
 if (authName == "petstore_auth") { 
 auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
 } else if (authName == "api_key") { 
 auth = new ApiKeyAuth("header", "api_key");
 } else {
 throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
 }
 apiAuthorizations.put(authName, auth);
}

@xhh xhh closed this Oct 27, 2015
@xhh xhh reopened this Oct 27, 2015
wing328 added a commit that referenced this pull request Oct 27, 2015
Fix syntax error on authMethods in java retrofit client
@wing328 wing328 merged commit cf59b5d into swagger-api:master Oct 27, 2015
@wing328 wing328 added this to the v2.1.5 milestone Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

v2.1.5

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /