Skip to content

Commit 8f2e9bc

Browse files
authored
remove trailing whitespaces in java api client (#4784)
1 parent 74da89c commit 8f2e9bc

File tree

7 files changed

+68
-37
lines changed

7 files changed

+68
-37
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,27 @@ public class ApiClient {
4545

4646
public ApiClient(String[] authNames) {
4747
this();
48-
for(String authName : authNames) { {{#hasAuthMethods}}
48+
for(String authName : authNames) {
49+
{{#hasAuthMethods}}
4950
RequestInterceptor auth;
50-
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
51-
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
52-
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
53-
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
51+
{{#authMethods}}if ("{{name}}".equals(authName)) {
52+
{{#isBasic}}
53+
auth = new HttpBasicAuth();
54+
{{/isBasic}}
55+
{{#isApiKey}}
56+
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
57+
{{/isApiKey}}
58+
{{#isOAuth}}
59+
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
60+
{{/isOAuth}}
5461
} else {{/authMethods}}{
5562
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
5663
}
57-
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
58-
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
64+
addAuthorization(authName, auth);
65+
{{/hasAuthMethods}}
66+
{{^hasAuthMethods}}
67+
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
68+
{{/hasAuthMethods}}
5969
}
6070
}
6171

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,26 @@ public class ApiClient {
5252

5353
public ApiClient(String[] authNames) {
5454
this();
55-
for(String authName : authNames) { {{#hasAuthMethods}}
55+
for(String authName : authNames) {
56+
{{#hasAuthMethods}}
5657
Interceptor auth;
57-
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
58-
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
59-
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
60-
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
58+
{{#authMethods}}if ("{{name}}".equals(authName)) {
59+
{{#isBasic}}
60+
auth = new HttpBasicAuth();
61+
{{/isBasic}}
62+
{{#isApiKey}}
63+
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}
64+
{{#isOAuth}}
65+
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
66+
{{/isOAuth}}
6167
} else {{/authMethods}}{
6268
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
6369
}
64-
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
65-
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
70+
addAuthorization(authName, auth);
71+
{{/hasAuthMethods}}
72+
{{^hasAuthMethods}}
73+
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
74+
{{/hasAuthMethods}}
6675
}
6776
}
6877

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,27 @@ public class ApiClient {
5858

5959
public ApiClient(String[] authNames) {
6060
this();
61-
for(String authName : authNames) { {{#hasAuthMethods}}
61+
for(String authName : authNames) {
62+
{{#hasAuthMethods}}
6263
Interceptor auth;
63-
{{#authMethods}}if ("{{name}}".equals(authName)) { {{#isBasic}}
64-
auth = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}}
65-
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}}
66-
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");{{/isOAuth}}
64+
{{#authMethods}}if ("{{name}}".equals(authName)) {
65+
{{#isBasic}}
66+
auth = new HttpBasicAuth();
67+
{{/isBasic}}
68+
{{#isApiKey}}
69+
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");
70+
{{/isApiKey}}
71+
{{#isOAuth}}
72+
auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{#hasMore}}, {{/hasMore}}{{/scopes}}");
73+
{{/isOAuth}}
6774
} else {{/authMethods}}{
6875
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
6976
}
70-
addAuthorization(authName, auth);{{/hasAuthMethods}}{{^hasAuthMethods}}
71-
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");{{/hasAuthMethods}}
77+
addAuthorization(authName, auth);
78+
{{/hasAuthMethods}}
79+
{{^hasAuthMethods}}
80+
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
81+
{{/hasAuthMethods}}
7282
}
7383
}
7484

samples/client/petstore/java/feign/src/main/java/io/swagger/client/ApiClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public ApiClient() {
4040

4141
public ApiClient(String[] authNames) {
4242
this();
43-
for(String authName : authNames) {
43+
for(String authName : authNames) {
4444
RequestInterceptor auth;
45-
if ("api_key".equals(authName)) {
45+
if ("api_key".equals(authName)) {
4646
auth = new ApiKeyAuth("header", "api_key");
47-
} else if ("http_basic_test".equals(authName)) {
47+
} else if ("http_basic_test".equals(authName)) {
4848
auth = new HttpBasicAuth();
49-
} else if ("petstore_auth".equals(authName)) {
49+
} else if ("petstore_auth".equals(authName)) {
5050
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
5151
} else {
5252
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");

samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/ApiClient.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ public ApiClient() {
5252

5353
public ApiClient(String[] authNames) {
5454
this();
55-
for(String authName : authNames) {
55+
for(String authName : authNames) {
5656
Interceptor auth;
57-
if ("api_key".equals(authName)) {
57+
if ("api_key".equals(authName)) {
5858
auth = new ApiKeyAuth("header", "api_key");
59-
} else if ("http_basic_test".equals(authName)) {
59+
} else if ("http_basic_test".equals(authName)) {
6060
auth = new HttpBasicAuth();
61-
} else if ("petstore_auth".equals(authName)) {
61+
62+
} else if ("petstore_auth".equals(authName)) {
63+
6264
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
6365
} else {
6466
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");

samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/ApiClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public ApiClient() {
5151

5252
public ApiClient(String[] authNames) {
5353
this();
54-
for(String authName : authNames) {
54+
for(String authName : authNames) {
5555
Interceptor auth;
56-
if ("api_key".equals(authName)) {
56+
if ("api_key".equals(authName)) {
5757
auth = new ApiKeyAuth("header", "api_key");
58-
} else if ("http_basic_test".equals(authName)) {
58+
} else if ("http_basic_test".equals(authName)) {
5959
auth = new HttpBasicAuth();
60-
} else if ("petstore_auth".equals(authName)) {
60+
} else if ("petstore_auth".equals(authName)) {
6161
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
6262
} else {
6363
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");

samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/ApiClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public ApiClient() {
5151

5252
public ApiClient(String[] authNames) {
5353
this();
54-
for(String authName : authNames) {
54+
for(String authName : authNames) {
5555
Interceptor auth;
56-
if (authName == "api_key") {
56+
if ("api_key".equals(authName)) {
5757
auth = new ApiKeyAuth("header", "api_key");
58-
} else if (authName == "http_basic_test") {
58+
} else if ("http_basic_test".equals(authName)) {
5959
auth = new HttpBasicAuth();
60-
} else if (authName == "petstore_auth") {
60+
} else if ("petstore_auth".equals(authName)) {
6161
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
6262
} else {
6363
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");

0 commit comments

Comments
 (0)