From 8f2e9bce6deb6ada27e331525d5f50c75c36f80b Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 13 Feb 2017 18:53:34 +0800 Subject: [PATCH] remove trailing whitespaces in java api client (#4784) --- .../Java/libraries/feign/ApiClient.mustache | 24 +++++++++++++------ .../libraries/retrofit/ApiClient.mustache | 23 ++++++++++++------ .../libraries/retrofit2/ApiClient.mustache | 24 +++++++++++++------ .../java/io/swagger/client/ApiClient.java | 8 +++---- .../java/io/swagger/client/ApiClient.java | 10 ++++---- .../java/io/swagger/client/ApiClient.java | 8 +++---- .../java/io/swagger/client/ApiClient.java | 8 +++---- 7 files changed, 68 insertions(+), 37 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache index d33a86763ff..17d0e96f313 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/feign/ApiClient.mustache @@ -45,17 +45,27 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { {{#hasAuthMethods}} + for(String authName : authNames) { + {{#hasAuthMethods}} RequestInterceptor auth; - {{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}} - auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}} - auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}} + {{#authMethods}}if ("{{name}}".equals(authName)) { + {{#isBasic}} + auth = new HttpBasicAuth(); + {{/isBasic}} + {{#isApiKey}} + auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"); + {{/isApiKey}} + {{#isOAuth}} + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } - addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}} - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}} + addAuthorization(authName, auth); + {{/hasAuthMethods}} + {{^hasAuthMethods}} + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + {{/hasAuthMethods}} } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache index 30de5917a34..7c45e926bcf 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit/ApiClient.mustache @@ -52,17 +52,26 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { {{#hasAuthMethods}} + for(String authName : authNames) { + {{#hasAuthMethods}} Interceptor auth; - {{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}} - auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}} - auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}} + {{#authMethods}}if ("{{name}}".equals(authName)) { + {{#isBasic}} + auth = new HttpBasicAuth(); + {{/isBasic}} + {{#isApiKey}} + auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}} + {{#isOAuth}} + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } - addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}} - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}} + addAuthorization(authName, auth); + {{/hasAuthMethods}} + {{^hasAuthMethods}} + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + {{/hasAuthMethods}} } } diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index 191b689c8c8..cc6b993e6ab 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -58,17 +58,27 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { {{#hasAuthMethods}} + for(String authName : authNames) { + {{#hasAuthMethods}} Interceptor auth; - {{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}} - auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}} - auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} - auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}} + {{#authMethods}}if ("{{name}}".equals(authName)) { + {{#isBasic}} + auth = new HttpBasicAuth(); + {{/isBasic}} + {{#isApiKey}} + auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"); + {{/isApiKey}} + {{#isOAuth}} + auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}"); + {{/isOAuth}} } else {{/authMethods}}{ throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); } - addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}} - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}} + addAuthorization(authName, auth); + {{/hasAuthMethods}} + {{^hasAuthMethods}} + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + {{/hasAuthMethods}} } } diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java index 90c60875979..51483828c52 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java @@ -40,13 +40,13 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { + for(String authName : authNames) { RequestInterceptor auth; - if ("api_key".equals(authName)) { + if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); - } else if ("http_basic_test".equals(authName)) { + } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { + } else if ("petstore_auth".equals(authName)) { 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"); diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java index ed9821db8f7..250c8f9550a 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java @@ -52,13 +52,15 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { + for(String authName : authNames) { Interceptor auth; - if ("api_key".equals(authName)) { + if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); - } else if ("http_basic_test".equals(authName)) { + } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { + + } else if ("petstore_auth".equals(authName)) { + 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"); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java index 4be862d52ff..99586dcab59 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java @@ -51,13 +51,13 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { + for(String authName : authNames) { Interceptor auth; - if ("api_key".equals(authName)) { + if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); - } else if ("http_basic_test".equals(authName)) { + } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); - } else if ("petstore_auth".equals(authName)) { + } else if ("petstore_auth".equals(authName)) { 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"); diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java index d3eb060514f..e3436cf56d0 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java @@ -51,13 +51,13 @@ public class ApiClient { public ApiClient(String[] authNames) { this(); - for(String authName : authNames) { + for(String authName : authNames) { Interceptor auth; - if (authName == "api_key") { + if ("api_key".equals(authName)) { auth = new ApiKeyAuth("header", "api_key"); - } else if (authName == "http_basic_test") { + } else if ("http_basic_test".equals(authName)) { auth = new HttpBasicAuth(); - } else if (authName == "petstore_auth") { + } else if ("petstore_auth".equals(authName)) { 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");