forked from loafle/openapi-generator-original
skip oauth files in java feign (#9760)
This commit is contained in:
@@ -395,9 +395,6 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportingFiles.add(new SupportingFile("ParamExpander.mustache", invokerFolder, "ParamExpander.java"));
|
||||
supportingFiles.add(new SupportingFile("EncodingUtils.mustache", invokerFolder, "EncodingUtils.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/DefaultApi20Impl.mustache", authFolder, "DefaultApi20Impl.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/OauthPasswordGrant.mustache", authFolder, "OauthPasswordGrant.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/OauthClientCredentialsGrant.mustache", authFolder, "OauthClientCredentialsGrant.java"));
|
||||
|
||||
} else if (OKHTTP_GSON.equals(getLibrary()) || StringUtils.isEmpty(getLibrary())) {
|
||||
// the "okhttp-gson" library template requires "ApiCallback.mustache" for async call
|
||||
supportingFiles.add(new SupportingFile("ApiCallback.mustache", invokerFolder, "ApiCallback.java"));
|
||||
@@ -598,6 +595,12 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/OAuthFlow.mustache", authFolder, "OAuthFlow.java"));
|
||||
}
|
||||
|
||||
// Add OauthPasswordGrant.java and OauthClientCredentialsGrant.java for feign library
|
||||
if (FEIGN.equals(getLibrary())) {
|
||||
supportingFiles.add(new SupportingFile("auth/OauthPasswordGrant.mustache", authFolder, "OauthPasswordGrant.java"));
|
||||
supportingFiles.add(new SupportingFile("auth/OauthClientCredentialsGrant.mustache", authFolder, "OauthClientCredentialsGrant.java"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public class ApiClient {
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
{{#isOAuth}}
|
||||
{{#hasOAuthMethods}}
|
||||
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||
switch (flow) {
|
||||
case password:
|
||||
@@ -173,8 +173,8 @@ public class ApiClient {
|
||||
throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented");
|
||||
}
|
||||
}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/hasOAuthMethods}}
|
||||
public ObjectMapper getObjectMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user