Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][Jersey] Better code format in the auto-generated doc #5031

Merged
merged 1 commit into from
Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ Method | HTTP request | Description

## {{operationId}}

{{^vendorExtensions.x-group-parameters}}> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute();{{/vendorExtensions.x-group-parameters}}
{{^vendorExtensions.x-group-parameters}}
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}.execute();
{{/vendorExtensions.x-group-parameters}}

{{summary}}{{#notes}}

Expand Down Expand Up @@ -60,12 +64,18 @@ public class Example {
{{#allParams}}
{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}}
try { {{^vendorExtensions.x-group-parameters}}
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}{{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
try {
{{^vendorExtensions.x-group-parameters}}
{{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/vendorExtensions.x-group-parameters}}
{{#vendorExtensions.x-group-parameters}}
{{#returnType}}{{{returnType}}} result = {{/returnType}}api.{{operationId}}({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}){{#allParams}}{{^isPathParam}}
.{{paramName}}({{paramName}}){{/isPathParam}}{{/allParams}}
.execute();{{/vendorExtensions.x-group-parameters}}
{{#returnType}}System.out.println(result);{{/returnType}}
.execute();
{{/vendorExtensions.x-group-parameters}}
{{#returnType}}
System.out.println(result);
{{/returnType}}
} catch (ApiException e) {
System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}");
System.err.println("Status code: " + e.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Method | HTTP request | Description

> Client call123testSpecialTags(body)


To test special tags

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

AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient);
Client body = new Client(); // Client | client model
try {
try {
Client result = apiInstance.call123testSpecialTags(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags");
Expand Down
64 changes: 14 additions & 50 deletions samples/client/petstore/java/jersey2-java6/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Method | HTTP request | Description

> createXmlItem(xmlItem)


creates an XmlItem

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

FakeApi apiInstance = new FakeApi(defaultClient);
XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body
try {
try {
apiInstance.createXmlItem(xmlItem);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#createXmlItem");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -94,7 +91,6 @@ No authorization required




Test serialization of outer boolean types

### Example
Expand All @@ -114,9 +110,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
Boolean body = true; // Boolean | Input boolean as post body
try {
try {
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
Expand Down Expand Up @@ -161,7 +156,6 @@ No authorization required




Test serialization of object with outer number type

### Example
Expand All @@ -181,9 +175,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
try {
try {
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
Expand Down Expand Up @@ -228,7 +221,6 @@ No authorization required




Test serialization of outer number types

### Example
Expand All @@ -248,9 +240,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
try {
try {
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize");
Expand Down Expand Up @@ -295,7 +286,6 @@ No authorization required




Test serialization of outer string types

### Example
Expand All @@ -315,9 +305,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
String body = "body_example"; // String | Input string as post body
try {
try {
String result = apiInstance.fakeOuterStringSerialize(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize");
Expand Down Expand Up @@ -362,7 +351,6 @@ No authorization required




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

### Example
Expand All @@ -382,10 +370,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass |
try {
try {
apiInstance.testBodyWithFileSchema(body);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithFileSchema");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -429,7 +415,6 @@ No authorization required




### Example

```java
Expand All @@ -448,10 +433,8 @@ public class Example {
FakeApi apiInstance = new FakeApi(defaultClient);
String query = "query_example"; // String |
User body = new User(); // User |
try {
try {
apiInstance.testBodyWithQueryParams(query, body);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -494,7 +477,6 @@ No authorization required

> Client testClientModel(body)


To test \"client\" model

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

FakeApi apiInstance = new FakeApi(defaultClient);
Client body = new Client(); // Client | client model
try {
try {
Client result = apiInstance.testClientModel(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testClientModel");
Expand Down Expand Up @@ -561,7 +542,6 @@ No authorization required

> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)


Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

Fake endpoint for testing various parameters
Expand Down Expand Up @@ -605,10 +585,8 @@ public class Example {
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
String password = "password_example"; // String | None
String paramCallback = "paramCallback_example"; // String | None
try {
try {
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEndpointParameters");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -664,7 +642,6 @@ null (empty response body)

> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)


To test enum parameters

To test enum parameters
Expand Down Expand Up @@ -693,10 +670,8 @@ public class Example {
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
List<String> enumFormStringArray = "$"; // List<String> | Form parameter enum test (string array)
String enumFormString = "-efg"; // String | Form parameter enum test (string)
try {
try {
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEnumParameters");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -744,7 +719,6 @@ No authorization required

## testGroupParameters


> testGroupParameters().requiredStringGroup(requiredStringGroup).requiredBooleanGroup(requiredBooleanGroup).requiredInt64Group(requiredInt64Group).stringGroup(stringGroup).booleanGroup(booleanGroup).int64Group(int64Group).execute();

Fake endpoint to test group parameters (optional)
Expand Down Expand Up @@ -773,7 +747,7 @@ public class Example {
Integer stringGroup = 56; // Integer | String in group parameters
Boolean booleanGroup = true; // Boolean | Boolean in group parameters
Long int64Group = 56L; // Long | Integer in group parameters
try {
try {
api.testGroupParameters()
.requiredStringGroup(requiredStringGroup)
.requiredBooleanGroup(requiredBooleanGroup)
Expand All @@ -782,7 +756,6 @@ public class Example {
.booleanGroup(booleanGroup)
.int64Group(int64Group)
.execute();

} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testGroupParameters");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -829,7 +802,6 @@ No authorization required

> testInlineAdditionalProperties(param)


test inline additionalProperties

### Example
Expand All @@ -849,10 +821,8 @@ public class Example {

FakeApi apiInstance = new FakeApi(defaultClient);
Map<String, String> param = new HashMap(); // Map<String, String> | request body
try {
try {
apiInstance.testInlineAdditionalProperties(param);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -894,7 +864,6 @@ No authorization required

> testJsonFormData(param, param2)


test json serialization of form data

### Example
Expand All @@ -915,10 +884,8 @@ public class Example {
FakeApi apiInstance = new FakeApi(defaultClient);
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
try {
apiInstance.testJsonFormData(param, param2);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
System.err.println("Status code: " + e.getCode());
Expand Down Expand Up @@ -963,7 +930,6 @@ No authorization required




To test the collection format in query parameters

### Example
Expand All @@ -987,10 +953,8 @@ public class Example {
List<String> http = Arrays.asList(); // List<String> |
List<String> url = Arrays.asList(); // List<String> |
List<String> context = Arrays.asList(); // List<String> |
try {
try {
apiInstance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context);


} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testQueryParameterCollectionFormat");
System.err.println("Status code: " + e.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Method | HTTP request | Description

> Client testClassname(body)


To test class name in snake case

To test class name in snake case
Expand Down Expand Up @@ -41,9 +40,8 @@ public class Example {

FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient);
Client body = new Client(); // Client | client model
try {
try {
Client result = apiInstance.testClassname(body);

System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");
Expand Down
Loading