Skip to content

Commit 2b74ae2

Browse files
committed
minor enhancement
1 parent d424b94 commit 2b74ae2

File tree

6 files changed

+2
-198
lines changed

6 files changed

+2
-198
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/api.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public class {{classname}} {
214214

215215
HttpContent content = {{#isBodyAllowed}}{{#bodyParam}}apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}new EmptyContent(){{/bodyParam}}{{/isBodyAllowed}}{{^isBodyAllowed}}null{{/isBodyAllowed}};
216216
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content);
217+
{{#hasHeaderParams}}
217218
// Note: Header params passed via 'params' map are handled below
218219
for (Map.Entry<String, Object> entry: params.entrySet()) {
219220
String key = entry.getKey();
@@ -225,6 +226,7 @@ public class {{classname}} {
225226
}
226227
{{/headerParams}}
227228
}
229+
{{/hasHeaderParams}}
228230
return httpRequest.execute();
229231
}
230232

samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeApi.java

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ public HttpResponse createXmlItemForHttpResponse(@javax.annotation.Nonnull XmlIt
134134

135135
HttpContent content = apiClient.new JacksonJsonHttpContent(xmlItem);
136136
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
137-
// Note: Header params passed via 'params' map are handled below
138-
for (Map.Entry<String, Object> entry: params.entrySet()) {
139-
String key = entry.getKey();
140-
Object value = entry.getValue();
141-
// Check if this is a header parameter by name
142-
}
143137
return httpRequest.execute();
144138
}
145139

@@ -223,12 +217,6 @@ public HttpResponse fakeOuterBooleanSerializeForHttpResponse(@javax.annotation.N
223217

224218
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
225219
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
226-
// Note: Header params passed via 'params' map are handled below
227-
for (Map.Entry<String, Object> entry: params.entrySet()) {
228-
String key = entry.getKey();
229-
Object value = entry.getValue();
230-
// Check if this is a header parameter by name
231-
}
232220
return httpRequest.execute();
233221
}
234222

@@ -312,12 +300,6 @@ public HttpResponse fakeOuterCompositeSerializeForHttpResponse(@javax.annotation
312300

313301
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
314302
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
315-
// Note: Header params passed via 'params' map are handled below
316-
for (Map.Entry<String, Object> entry: params.entrySet()) {
317-
String key = entry.getKey();
318-
Object value = entry.getValue();
319-
// Check if this is a header parameter by name
320-
}
321303
return httpRequest.execute();
322304
}
323305

@@ -401,12 +383,6 @@ public HttpResponse fakeOuterNumberSerializeForHttpResponse(@javax.annotation.Nu
401383

402384
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
403385
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
404-
// Note: Header params passed via 'params' map are handled below
405-
for (Map.Entry<String, Object> entry: params.entrySet()) {
406-
String key = entry.getKey();
407-
Object value = entry.getValue();
408-
// Check if this is a header parameter by name
409-
}
410386
return httpRequest.execute();
411387
}
412388

@@ -490,12 +466,6 @@ public HttpResponse fakeOuterStringSerializeForHttpResponse(@javax.annotation.Nu
490466

491467
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
492468
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
493-
// Note: Header params passed via 'params' map are handled below
494-
for (Map.Entry<String, Object> entry: params.entrySet()) {
495-
String key = entry.getKey();
496-
Object value = entry.getValue();
497-
// Check if this is a header parameter by name
498-
}
499469
return httpRequest.execute();
500470
}
501471

@@ -583,12 +553,6 @@ public HttpResponse testBodyWithFileSchemaForHttpResponse(@javax.annotation.Nonn
583553

584554
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
585555
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content);
586-
// Note: Header params passed via 'params' map are handled below
587-
for (Map.Entry<String, Object> entry: params.entrySet()) {
588-
String key = entry.getKey();
589-
Object value = entry.getValue();
590-
// Check if this is a header parameter by name
591-
}
592556
return httpRequest.execute();
593557
}
594558

@@ -709,12 +673,6 @@ public HttpResponse testBodyWithQueryParamsForHttpResponse(@javax.annotation.Non
709673

710674
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
711675
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content);
712-
// Note: Header params passed via 'params' map are handled below
713-
for (Map.Entry<String, Object> entry: params.entrySet()) {
714-
String key = entry.getKey();
715-
Object value = entry.getValue();
716-
// Check if this is a header parameter by name
717-
}
718676
return httpRequest.execute();
719677
}
720678

@@ -810,12 +768,6 @@ public HttpResponse testClientModelForHttpResponse(@javax.annotation.Nonnull Cli
810768

811769
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
812770
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content);
813-
// Note: Header params passed via 'params' map are handled below
814-
for (Map.Entry<String, Object> entry: params.entrySet()) {
815-
String key = entry.getKey();
816-
Object value = entry.getValue();
817-
// Check if this is a header parameter by name
818-
}
819771
return httpRequest.execute();
820772
}
821773

@@ -924,12 +876,6 @@ public HttpResponse testEndpointParametersForHttpResponse(@javax.annotation.Nonn
924876

925877
HttpContent content = new EmptyContent();
926878
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
927-
// Note: Header params passed via 'params' map are handled below
928-
for (Map.Entry<String, Object> entry: params.entrySet()) {
929-
String key = entry.getKey();
930-
Object value = entry.getValue();
931-
// Check if this is a header parameter by name
932-
}
933879
return httpRequest.execute();
934880
}
935881

@@ -1304,12 +1250,6 @@ public HttpResponse testInlineAdditionalPropertiesForHttpResponse(@javax.annotat
13041250

13051251
HttpContent content = apiClient.new JacksonJsonHttpContent(param);
13061252
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
1307-
// Note: Header params passed via 'params' map are handled below
1308-
for (Map.Entry<String, Object> entry: params.entrySet()) {
1309-
String key = entry.getKey();
1310-
Object value = entry.getValue();
1311-
// Check if this is a header parameter by name
1312-
}
13131253
return httpRequest.execute();
13141254
}
13151255

@@ -1388,12 +1328,6 @@ public HttpResponse testJsonFormDataForHttpResponse(@javax.annotation.Nonnull St
13881328

13891329
HttpContent content = null;
13901330
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
1391-
// Note: Header params passed via 'params' map are handled below
1392-
for (Map.Entry<String, Object> entry: params.entrySet()) {
1393-
String key = entry.getKey();
1394-
Object value = entry.getValue();
1395-
// Check if this is a header parameter by name
1396-
}
13971331
return httpRequest.execute();
13981332
}
13991333

@@ -1557,12 +1491,6 @@ public HttpResponse testQueryParameterCollectionFormatForHttpResponse(@javax.ann
15571491

15581492
HttpContent content = new EmptyContent();
15591493
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content);
1560-
// Note: Header params passed via 'params' map are handled below
1561-
for (Map.Entry<String, Object> entry: params.entrySet()) {
1562-
String key = entry.getKey();
1563-
Object value = entry.getValue();
1564-
// Check if this is a header parameter by name
1565-
}
15661494
return httpRequest.execute();
15671495
}
15681496

samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ public HttpResponse testClassnameForHttpResponse(@javax.annotation.Nonnull Clien
132132

133133
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
134134
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content);
135-
// Note: Header params passed via 'params' map are handled below
136-
for (Map.Entry<String, Object> entry: params.entrySet()) {
137-
String key = entry.getKey();
138-
Object value = entry.getValue();
139-
// Check if this is a header parameter by name
140-
}
141135
return httpRequest.execute();
142136
}
143137

samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ public HttpResponse addPetForHttpResponse(@javax.annotation.Nonnull Pet body, Ma
129129

130130
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
131131
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
132-
// Note: Header params passed via 'params' map are handled below
133-
for (Map.Entry<String, Object> entry: params.entrySet()) {
134-
String key = entry.getKey();
135-
Object value = entry.getValue();
136-
// Check if this is a header parameter by name
137-
}
138132
return httpRequest.execute();
139133
}
140134

@@ -319,12 +313,6 @@ public HttpResponse findPetsByStatusForHttpResponse(@javax.annotation.Nonnull Li
319313

320314
HttpContent content = null;
321315
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
322-
// Note: Header params passed via 'params' map are handled below
323-
for (Map.Entry<String, Object> entry: params.entrySet()) {
324-
String key = entry.getKey();
325-
Object value = entry.getValue();
326-
// Check if this is a header parameter by name
327-
}
328316
return httpRequest.execute();
329317
}
330318

@@ -426,12 +414,6 @@ public HttpResponse findPetsByTagsForHttpResponse(@javax.annotation.Nonnull Set<
426414

427415
HttpContent content = null;
428416
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
429-
// Note: Header params passed via 'params' map are handled below
430-
for (Map.Entry<String, Object> entry: params.entrySet()) {
431-
String key = entry.getKey();
432-
Object value = entry.getValue();
433-
// Check if this is a header parameter by name
434-
}
435417
return httpRequest.execute();
436418
}
437419

@@ -520,12 +502,6 @@ public HttpResponse getPetByIdForHttpResponse(@javax.annotation.Nonnull Long pet
520502

521503
HttpContent content = null;
522504
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
523-
// Note: Header params passed via 'params' map are handled below
524-
for (Map.Entry<String, Object> entry: params.entrySet()) {
525-
String key = entry.getKey();
526-
Object value = entry.getValue();
527-
// Check if this is a header parameter by name
528-
}
529505
return httpRequest.execute();
530506
}
531507

@@ -619,12 +595,6 @@ public HttpResponse updatePetForHttpResponse(@javax.annotation.Nonnull Pet body,
619595

620596
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
621597
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content);
622-
// Note: Header params passed via 'params' map are handled below
623-
for (Map.Entry<String, Object> entry: params.entrySet()) {
624-
String key = entry.getKey();
625-
Object value = entry.getValue();
626-
// Check if this is a header parameter by name
627-
}
628598
return httpRequest.execute();
629599
}
630600

@@ -703,12 +673,6 @@ public HttpResponse updatePetWithFormForHttpResponse(@javax.annotation.Nonnull L
703673

704674
HttpContent content = new EmptyContent();
705675
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
706-
// Note: Header params passed via 'params' map are handled below
707-
for (Map.Entry<String, Object> entry: params.entrySet()) {
708-
String key = entry.getKey();
709-
Object value = entry.getValue();
710-
// Check if this is a header parameter by name
711-
}
712676
return httpRequest.execute();
713677
}
714678

@@ -793,12 +757,6 @@ public HttpResponse uploadFileForHttpResponse(@javax.annotation.Nonnull Long pet
793757

794758
HttpContent content = new EmptyContent();
795759
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
796-
// Note: Header params passed via 'params' map are handled below
797-
for (Map.Entry<String, Object> entry: params.entrySet()) {
798-
String key = entry.getKey();
799-
Object value = entry.getValue();
800-
// Check if this is a header parameter by name
801-
}
802760
return httpRequest.execute();
803761
}
804762

@@ -890,12 +848,6 @@ public HttpResponse uploadFileWithRequiredFileForHttpResponse(@javax.annotation.
890848

891849
HttpContent content = new EmptyContent();
892850
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
893-
// Note: Header params passed via 'params' map are handled below
894-
for (Map.Entry<String, Object> entry: params.entrySet()) {
895-
String key = entry.getKey();
896-
Object value = entry.getValue();
897-
// Check if this is a header parameter by name
898-
}
899851
return httpRequest.execute();
900852
}
901853

samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/api/StoreApi.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ public HttpResponse deleteOrderForHttpResponse(@javax.annotation.Nonnull String
117117

118118
HttpContent content = null;
119119
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content);
120-
// Note: Header params passed via 'params' map are handled below
121-
for (Map.Entry<String, Object> entry: params.entrySet()) {
122-
String key = entry.getKey();
123-
Object value = entry.getValue();
124-
// Check if this is a header parameter by name
125-
}
126120
return httpRequest.execute();
127121
}
128122

@@ -193,12 +187,6 @@ public HttpResponse getInventoryForHttpResponse(Map<String, Object> params) thro
193187

194188
HttpContent content = null;
195189
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
196-
// Note: Header params passed via 'params' map are handled below
197-
for (Map.Entry<String, Object> entry: params.entrySet()) {
198-
String key = entry.getKey();
199-
Object value = entry.getValue();
200-
// Check if this is a header parameter by name
201-
}
202190
return httpRequest.execute();
203191
}
204192

@@ -287,12 +275,6 @@ public HttpResponse getOrderByIdForHttpResponse(@javax.annotation.Nonnull Long o
287275

288276
HttpContent content = null;
289277
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content);
290-
// Note: Header params passed via 'params' map are handled below
291-
for (Map.Entry<String, Object> entry: params.entrySet()) {
292-
String key = entry.getKey();
293-
Object value = entry.getValue();
294-
// Check if this is a header parameter by name
295-
}
296278
return httpRequest.execute();
297279
}
298280

@@ -388,12 +370,6 @@ public HttpResponse placeOrderForHttpResponse(@javax.annotation.Nonnull Order bo
388370

389371
HttpContent content = apiClient.new JacksonJsonHttpContent(body);
390372
com.google.api.client.http.HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
391-
// Note: Header params passed via 'params' map are handled below
392-
for (Map.Entry<String, Object> entry: params.entrySet()) {
393-
String key = entry.getKey();
394-
Object value = entry.getValue();
395-
// Check if this is a header parameter by name
396-
}
397373
return httpRequest.execute();
398374
}
399375

0 commit comments

Comments
 (0)