Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f7a841c
Merge pull request #1 from OpenAPITools/master
MosheElisha Jul 12, 2020
4825167
Merge pull request #2 from OpenAPITools/master
MosheElisha Jul 20, 2020
1b40348
Merge pull request #3 from OpenAPITools/master
MosheElisha Jul 26, 2020
13513b3
Merge remote-tracking branch 'upstream/master'
MosheElisha Jan 27, 2021
3f73667
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Jan 27, 2021
335c304
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Jan 27, 2021
56e2b1f
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Jan 27, 2021
ace2fc1
Revert "Fix #8027 - import the auto generated supporting JSON class o…
MosheElisha Jan 28, 2021
2ba2b55
Revert "Fix #8027 - import the auto generated supporting JSON class o…
MosheElisha Jan 28, 2021
d55e247
Merge remote-tracking branch 'upstream/master'
MosheElisha Jan 31, 2021
f410537
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 1, 2021
5489a88
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 3, 2021
266980f
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Feb 3, 2021
6c1d37b
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 4, 2021
cc83ad3
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Feb 4, 2021
18749bd
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Feb 5, 2021
2f9ba6c
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 5, 2021
618aca3
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 6, 2021
bfe816e
Merge remote-tracking branch 'upstream/master'
MosheElisha Feb 10, 2021
c0902f9
Fix #8027 - import the auto generated supporting JSON class only when…
MosheElisha Feb 10, 2021
b010d41
Merge remote-tracking branch 'upstream/master'
MosheElisha Mar 26, 2021
f47ef2b
[Java] [Native] Add response body to exception message
MosheElisha Apr 4, 2021
94404dc
Merge remote-tracking branch 'upstream/master'
MosheElisha Apr 5, 2021
46be033
[Java] [Native] Use default base URI if baseUri param is null
MosheElisha Apr 5, 2021
250ab67
[Java] [Native] Use default base URI if baseUri param is null
MosheElisha Apr 5, 2021
69cd780
Merge remote-tracking branch 'upstream/master'
MosheElisha Apr 5, 2021
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 @@ -171,7 +171,7 @@ public class ApiClient {
public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
this.builder = builder;
this.mapper = mapper;
updateBaseUri(baseUri);
updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
interceptor = null;
readTimeout = null;
responseInterceptor = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ public class {{classname}} {
}
{{/asyncNative}}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

{{#operation}}
{{#vendorExtensions.x-group-parameters}}
{{#hasParams}}
Expand Down Expand Up @@ -207,10 +215,7 @@ public class {{classname}} {
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"{{operationId}} call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "{{operationId}} call received non-success response");
}
return new ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>(
localVarResponse.statusCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public ApiClient() {
public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
this.builder = builder;
this.mapper = mapper;
updateBaseUri(baseUri);
updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
interceptor = null;
readTimeout = null;
responseInterceptor = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* To test special tags
* To test special tags and operation ID starting with number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* creates an XmlItem
* this route creates an XmlItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* To test class name in snake case
* To test class name in snake case
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* Add a new pet to the store
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ private ApiException getApiException(String operationId, HttpResponse<String>loc
localVarResponse.body());
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* Create user
* This can only be done by the logged in user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public ApiClient() {
public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) {
this.builder = builder;
this.mapper = mapper;
updateBaseUri(baseUri);
updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
interceptor = null;
readTimeout = null;
responseInterceptor = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public AnotherFakeApi(ApiClient apiClient) {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* To test special tags
* To test special tags and operation ID starting with number
Expand Down Expand Up @@ -87,10 +95,7 @@ public ApiResponse<Client> call123testSpecialTagsWithHttpInfo(Client body) throw
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"call123testSpecialTags call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "call123testSpecialTags call received non-success response");
}
return new ApiResponse<Client>(
localVarResponse.statusCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public FakeApi(ApiClient apiClient) {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* creates an XmlItem
* this route creates an XmlItem
Expand Down Expand Up @@ -93,10 +101,7 @@ public ApiResponse<Void> createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiEx
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"createXmlItem call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "createXmlItem call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -170,10 +175,7 @@ public ApiResponse<Boolean> fakeOuterBooleanSerializeWithHttpInfo(Boolean body)
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"fakeOuterBooleanSerialize call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "fakeOuterBooleanSerialize call received non-success response");
}
return new ApiResponse<Boolean>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -243,10 +245,7 @@ public ApiResponse<OuterComposite> fakeOuterCompositeSerializeWithHttpInfo(Outer
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"fakeOuterCompositeSerialize call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "fakeOuterCompositeSerialize call received non-success response");
}
return new ApiResponse<OuterComposite>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -316,10 +315,7 @@ public ApiResponse<BigDecimal> fakeOuterNumberSerializeWithHttpInfo(BigDecimal b
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"fakeOuterNumberSerialize call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "fakeOuterNumberSerialize call received non-success response");
}
return new ApiResponse<BigDecimal>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -389,10 +385,7 @@ public ApiResponse<String> fakeOuterStringSerializeWithHttpInfo(String body) thr
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"fakeOuterStringSerialize call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "fakeOuterStringSerialize call received non-success response");
}
return new ApiResponse<String>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -460,10 +453,7 @@ public ApiResponse<Void> testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testBodyWithFileSchema call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testBodyWithFileSchema call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -537,10 +527,7 @@ public ApiResponse<Void> testBodyWithQueryParamsWithHttpInfo(String query, User
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testBodyWithQueryParams call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testBodyWithQueryParams call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -627,10 +614,7 @@ public ApiResponse<Client> testClientModelWithHttpInfo(Client body) throws ApiEx
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testClientModel call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testClientModel call received non-success response");
}
return new ApiResponse<Client>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -728,10 +712,7 @@ public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, D
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testEndpointParameters call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testEndpointParameters call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -823,10 +804,7 @@ public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderS
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testEnumParameters call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testEnumParameters call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -949,10 +927,7 @@ public ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringG
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testGroupParameters call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testGroupParameters call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -1121,10 +1096,7 @@ public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String,
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testInlineAdditionalProperties call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testInlineAdditionalProperties call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -1198,10 +1170,7 @@ public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testJsonFormData call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testJsonFormData call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down Expand Up @@ -1279,10 +1248,7 @@ public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<Str
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testQueryParameterCollectionFormat call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testQueryParameterCollectionFormat call received non-success response");
}
return new ApiResponse<Void>(
localVarResponse.statusCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public FakeClassnameTags123Api(ApiClient apiClient) {
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
}

protected ApiException createApiException(HttpResponse<InputStream> response, String msgPrefix) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
if (body != null) {
msgPrefix += ": " + body;
}
return new ApiException(response.statusCode(), msgPrefix, response.headers(), body);
}

/**
* To test class name in snake case
* To test class name in snake case
Expand Down Expand Up @@ -87,10 +95,7 @@ public ApiResponse<Client> testClassnameWithHttpInfo(Client body) throws ApiExce
memberVarResponseInterceptor.accept(localVarResponse);
}
if (localVarResponse.statusCode()/ 100 != 2) {
throw new ApiException(localVarResponse.statusCode(),
"testClassname call received non-success response",
localVarResponse.headers(),
localVarResponse.body() == null ? null : new String(localVarResponse.body().readAllBytes()));
throw createApiException(localVarResponse, "testClassname call received non-success response");
}
return new ApiResponse<Client>(
localVarResponse.statusCode(),
Expand Down
Loading