Skip to content

Commit d1948c4

Browse files
authored
better code format in java jersey doc (#5031)
1 parent 2722c60 commit d1948c4

File tree

19 files changed

+128
-397
lines changed

19 files changed

+128
-397
lines changed

modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api_doc.mustache

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ Method | HTTP request | Description
1414

1515
## {{operationId}}
1616

17-
{{^vendorExtensions.x-group-parameters}}> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}
18-
{{#vendorExtensions.x-group-parameters}}> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute();{{/vendorExtensions.x-group-parameters}}
17+
{{^vendorExtensions.x-group-parameters}}
18+
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
19+
{{/vendorExtensions.x-group-parameters}}
20+
{{#vendorExtensions.x-group-parameters}}
21+
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute();
22+
{{/vendorExtensions.x-group-parameters}}
1923

2024
{{summary}}{{#notes}}
2125

@@ -60,12 +64,18 @@ public class Example {
6064
{{#allParams}}
6165
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
6266
{{/allParams}}
63-
try { {{^vendorExtensions.x-group-parameters}}
64-
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}
65-
{{#vendorExtensions.x-group-parameters}}{{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
67+
try {
68+
{{^vendorExtensions.x-group-parameters}}
69+
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
70+
{{/vendorExtensions.x-group-parameters}}
71+
{{#vendorExtensions.x-group-parameters}}
72+
{{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
6673
.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}
67-
.execute();{{/vendorExtensions.x-group-parameters}}
68-
{{#returnType}}System.out.println(result);{{/returnType}}
74+
.execute();
75+
{{/vendorExtensions.x-group-parameters}}
76+
{{#returnType}}
77+
System.out.println(result);
78+
{{/returnType}}
6979
} catch (ApiException e) {
7080
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
7181
System.err.println("Status code: " + e.getCode());

samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Method | HTTP request | Description
1212

1313
> Client call123testSpecialTags(body)
1414
15-
1615
To test special tags
1716

1817
To test special tags and operation ID starting with number
@@ -34,9 +33,8 @@ public class Example {
3433

3534
AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
3635
Client body = new Client(); // Client | client model
37-
try {
36+
try {
3837
Client result = apiInstance.call123testSpecialTags(body);
39-
4038
System.out.println(result);
4139
} catch (ApiException e) {
4240
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");

samples/client/petstore/java/jersey2-java6/docs/FakeApi.md

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Method | HTTP request | Description
2525

2626
> createXmlItem(xmlItem)
2727
28-
2928
creates an XmlItem
3029

3130
this route creates an XmlItem
@@ -47,10 +46,8 @@ public class Example {
4746

4847
FakeApi apiInstance = new FakeApi(defaultClient);
4948
XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body
50-
try {
49+
try {
5150
apiInstance.createXmlItem(xmlItem);
52-
53-
5451
} catch (ApiException e) {
5552
System.err.println("Exception when calling FakeApi#createXmlItem");
5653
System.err.println("Status code: " + e.getCode());
@@ -94,7 +91,6 @@ No authorization required
9491
9592

9693

97-
9894
Test serialization of outer boolean types
9995

10096
### Example
@@ -114,9 +110,8 @@ public class Example {
114110

115111
FakeApi apiInstance = new FakeApi(defaultClient);
116112
Boolean body = true; // Boolean | Input boolean as post body
117-
try {
113+
try {
118114
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
119-
120115
System.out.println(result);
121116
} catch (ApiException e) {
122117
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
@@ -161,7 +156,6 @@ No authorization required
161156
162157

163158

164-
165159
Test serialization of object with outer number type
166160

167161
### Example
@@ -181,9 +175,8 @@ public class Example {
181175

182176
FakeApi apiInstance = new FakeApi(defaultClient);
183177
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
184-
try {
178+
try {
185179
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);
186-
187180
System.out.println(result);
188181
} catch (ApiException e) {
189182
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
@@ -228,7 +221,6 @@ No authorization required
228221
229222

230223

231-
232224
Test serialization of outer number types
233225

234226
### Example
@@ -248,9 +240,8 @@ public class Example {
248240

249241
FakeApi apiInstance = new FakeApi(defaultClient);
250242
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
251-
try {
243+
try {
252244
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
253-
254245
System.out.println(result);
255246
} catch (ApiException e) {
256247
System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize");
@@ -295,7 +286,6 @@ No authorization required
295286
296287

297288

298-
299289
Test serialization of outer string types
300290

301291
### Example
@@ -315,9 +305,8 @@ public class Example {
315305

316306
FakeApi apiInstance = new FakeApi(defaultClient);
317307
String body = "body_example"; // String | Input string as post body
318-
try {
308+
try {
319309
String result = apiInstance.fakeOuterStringSerialize(body);
320-
321310
System.out.println(result);
322311
} catch (ApiException e) {
323312
System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize");
@@ -362,7 +351,6 @@ No authorization required
362351
363352

364353

365-
366354
For this test, the body for this request much reference a schema named `File`.
367355

368356
### Example
@@ -382,10 +370,8 @@ public class Example {
382370

383371
FakeApi apiInstance = new FakeApi(defaultClient);
384372
FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass |
385-
try {
373+
try {
386374
apiInstance.testBodyWithFileSchema(body);
387-
388-
389375
} catch (ApiException e) {
390376
System.err.println("Exception when calling FakeApi#testBodyWithFileSchema");
391377
System.err.println("Status code: " + e.getCode());
@@ -429,7 +415,6 @@ No authorization required
429415
430416

431417

432-
433418
### Example
434419

435420
```java
@@ -448,10 +433,8 @@ public class Example {
448433
FakeApi apiInstance = new FakeApi(defaultClient);
449434
String query = "query_example"; // String |
450435
User body = new User(); // User |
451-
try {
436+
try {
452437
apiInstance.testBodyWithQueryParams(query, body);
453-
454-
455438
} catch (ApiException e) {
456439
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
457440
System.err.println("Status code: " + e.getCode());
@@ -494,7 +477,6 @@ No authorization required
494477

495478
> Client testClientModel(body)
496479
497-
498480
To test \"client\" model
499481

500482
To test "client" model
@@ -516,9 +498,8 @@ public class Example {
516498

517499
FakeApi apiInstance = new FakeApi(defaultClient);
518500
Client body = new Client(); // Client | client model
519-
try {
501+
try {
520502
Client result = apiInstance.testClientModel(body);
521-
522503
System.out.println(result);
523504
} catch (ApiException e) {
524505
System.err.println("Exception when calling FakeApi#testClientModel");
@@ -561,7 +542,6 @@ No authorization required
561542

562543
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
563544
564-
565545
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
566546

567547
Fake endpoint for testing various parameters
@@ -605,10 +585,8 @@ public class Example {
605585
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
606586
String password = "password_example"; // String | None
607587
String paramCallback = "paramCallback_example"; // String | None
608-
try {
588+
try {
609589
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
610-
611-
612590
} catch (ApiException e) {
613591
System.err.println("Exception when calling FakeApi#testEndpointParameters");
614592
System.err.println("Status code: " + e.getCode());
@@ -664,7 +642,6 @@ null (empty response body)
664642

665643
> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
666644
667-
668645
To test enum parameters
669646

670647
To test enum parameters
@@ -693,10 +670,8 @@ public class Example {
693670
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
694671
List<String> enumFormStringArray = "$"; // List<String> | Form parameter enum test (string array)
695672
String enumFormString = "-efg"; // String | Form parameter enum test (string)
696-
try {
673+
try {
697674
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
698-
699-
700675
} catch (ApiException e) {
701676
System.err.println("Exception when calling FakeApi#testEnumParameters");
702677
System.err.println("Status code: " + e.getCode());
@@ -744,7 +719,6 @@ No authorization required
744719

745720
## testGroupParameters
746721

747-
748722
> testGroupParameters().requiredStringGroup(requiredStringGroup).requiredBooleanGroup(requiredBooleanGroup).requiredInt64Group(requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute();
749723
750724
Fake endpoint to test group parameters (optional)
@@ -773,7 +747,7 @@ public class Example {
773747
Integer stringGroup = 56; // Integer | String in group parameters
774748
Boolean booleanGroup = true; // Boolean | Boolean in group parameters
775749
Long int64Group = 56L; // Long | Integer in group parameters
776-
try {
750+
try {
777751
api.testGroupParameters()
778752
.requiredStringGroup(requiredStringGroup)
779753
.requiredBooleanGroup(requiredBooleanGroup)
@@ -782,7 +756,6 @@ public class Example {
782756
.booleanGroup(booleanGroup)
783757
.int64Group(int64Group)
784758
.execute();
785-
786759
} catch (ApiException e) {
787760
System.err.println("Exception when calling FakeApi#testGroupParameters");
788761
System.err.println("Status code: " + e.getCode());
@@ -829,7 +802,6 @@ No authorization required
829802

830803
> testInlineAdditionalProperties(param)
831804
832-
833805
test inline additionalProperties
834806

835807
### Example
@@ -849,10 +821,8 @@ public class Example {
849821

850822
FakeApi apiInstance = new FakeApi(defaultClient);
851823
Map<String, String> param = new HashMap(); // Map<String, String> | request body
852-
try {
824+
try {
853825
apiInstance.testInlineAdditionalProperties(param);
854-
855-
856826
} catch (ApiException e) {
857827
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
858828
System.err.println("Status code: " + e.getCode());
@@ -894,7 +864,6 @@ No authorization required
894864

895865
> testJsonFormData(param, param2)
896866
897-
898867
test json serialization of form data
899868

900869
### Example
@@ -915,10 +884,8 @@ public class Example {
915884
FakeApi apiInstance = new FakeApi(defaultClient);
916885
String param = "param_example"; // String | field1
917886
String param2 = "param2_example"; // String | field2
918-
try {
887+
try {
919888
apiInstance.testJsonFormData(param, param2);
920-
921-
922889
} catch (ApiException e) {
923890
System.err.println("Exception when calling FakeApi#testJsonFormData");
924891
System.err.println("Status code: " + e.getCode());
@@ -963,7 +930,6 @@ No authorization required
963930
964931

965932

966-
967933
To test the collection format in query parameters
968934

969935
### Example
@@ -987,10 +953,8 @@ public class Example {
987953
List<String> http = Arrays.asList(); // List<String> |
988954
List<String> url = Arrays.asList(); // List<String> |
989955
List<String> context = Arrays.asList(); // List<String> |
990-
try {
956+
try {
991957
apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);
992-
993-
994958
} catch (ApiException e) {
995959
System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat");
996960
System.err.println("Status code: " + e.getCode());

samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Method | HTTP request | Description
1212

1313
> Client testClassname(body)
1414
15-
1615
To test class name in snake case
1716

1817
To test class name in snake case
@@ -41,9 +40,8 @@ public class Example {
4140

4241
FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient);
4342
Client body = new Client(); // Client | client model
44-
try {
43+
try {
4544
Client result = apiInstance.testClassname(body);
46-
4745
System.out.println(result);
4846
} catch (ApiException e) {
4947
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");

0 commit comments

Comments
 (0)