forked from loafle/openapi-generator-original
Fix response body in Java native client (#14222)
* fix response body in java native client * add new files * update samples
This commit is contained in:
parent
b8b25e8ae0
commit
1fad61e2f8
@ -239,10 +239,9 @@ public class {{classname}} {
|
||||
}
|
||||
{{#vendorExtensions.x-java-text-plain-string}}
|
||||
// for plain text response
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@ -254,14 +253,11 @@ public class {{classname}} {
|
||||
}
|
||||
{{/vendorExtensions.x-java-text-plain-string}}
|
||||
{{^vendorExtensions.x-java-text-plain-string}}
|
||||
{{#returnType}}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
{{/returnType}}
|
||||
return new ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
{{#returnType}}
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<{{{returnType}}}>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<{{{returnType}}}>() {}) // closes the InputStream
|
||||
{{/returnType}}
|
||||
{{^returnType}}
|
||||
null
|
||||
|
@ -26,6 +26,10 @@ info:
|
||||
servers:
|
||||
- url: http://localhost:3000/
|
||||
paths:
|
||||
# Path usually starts with parameter type such as path, query, header, form
|
||||
# For body/form parameters, path starts with "/echo" so the the echo server
|
||||
# will response with the same body in the HTTP request.
|
||||
#
|
||||
# path parameter tests
|
||||
/path/string/{path_string}/integer/{path_integer}:
|
||||
get:
|
||||
@ -133,8 +137,31 @@ paths:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
/echo/body/Pet:
|
||||
post:
|
||||
tags:
|
||||
- body
|
||||
summary: Test body parameter(s)
|
||||
description: Test body parameter(s)
|
||||
operationId: test/echo/body/Pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
schemas:
|
||||
Category:
|
||||
type: object
|
||||
|
@ -5,6 +5,7 @@ README.md
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
docs/BodyApi.md
|
||||
docs/Category.md
|
||||
docs/PathApi.md
|
||||
docs/Pet.md
|
||||
@ -29,6 +30,7 @@ src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||
src/main/java/org/openapitools/client/ServerVariable.java
|
||||
src/main/java/org/openapitools/client/StringUtil.java
|
||||
src/main/java/org/openapitools/client/api/BodyApi.java
|
||||
src/main/java/org/openapitools/client/api/PathApi.java
|
||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||
|
@ -75,22 +75,21 @@ Please follow the [installation](#installation) instruction and execute the foll
|
||||
import org.openapitools.client.*;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.PathApi;
|
||||
import org.openapitools.client.api.BodyApi;
|
||||
|
||||
public class PathApiExample {
|
||||
public class BodyApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
PathApi apiInstance = new PathApi(defaultClient);
|
||||
String pathString = "pathString_example"; // String |
|
||||
Integer pathInteger = 56; // Integer |
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||
Pet result = apiInstance.testEchoBodyPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
@ -107,6 +106,7 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
|
@ -124,9 +124,37 @@ paths:
|
||||
tags:
|
||||
- query
|
||||
x-accepts: text/plain
|
||||
/echo/body/Pet:
|
||||
post:
|
||||
description: Test body parameter(s)
|
||||
operationId: test/echo/body/Pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Successful operation
|
||||
summary: Test body parameter(s)
|
||||
tags:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
schemas:
|
||||
Category:
|
||||
example:
|
||||
name: Dogs
|
||||
id: 1
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
@ -139,6 +167,9 @@ components:
|
||||
xml:
|
||||
name: category
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
id: 0
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
@ -149,6 +180,21 @@ components:
|
||||
xml:
|
||||
name: tag
|
||||
Pet:
|
||||
example:
|
||||
photoUrls:
|
||||
- photoUrls
|
||||
- photoUrls
|
||||
name: doggie
|
||||
id: 10
|
||||
category:
|
||||
name: Dogs
|
||||
id: 1
|
||||
tags:
|
||||
- name: name
|
||||
id: 0
|
||||
- name: name
|
||||
id: 0
|
||||
status: available
|
||||
properties:
|
||||
id:
|
||||
example: 10
|
||||
|
@ -0,0 +1,75 @@
|
||||
# BodyApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
|
||||
|
||||
|
||||
## testEchoBodyPet
|
||||
|
||||
> Pet testEchoBodyPet(pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.models.*;
|
||||
import org.openapitools.client.api.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
Pet result = apiInstance.testEchoBodyPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import org.openapitools.client.model.Pet;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class BodyApi {
|
||||
private ApiClient apiClient;
|
||||
|
||||
public BodyApi() {
|
||||
this(Configuration.getDefaultApiClient());
|
||||
}
|
||||
|
||||
public BodyApi(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
public ApiClient getApiClient() {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
public void setApiClient(ApiClient apiClient) {
|
||||
this.apiClient = apiClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return Pet
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public Pet testEchoBodyPet(Pet pet) throws ApiException {
|
||||
Object localVarPostBody = pet;
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "/echo/body/Pet";
|
||||
|
||||
// query params
|
||||
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||
|
||||
|
||||
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
TypeReference<Pet> localVarReturnType = new TypeReference<Pet>() {};
|
||||
return apiClient.invokeAPI(
|
||||
localVarPath,
|
||||
"POST",
|
||||
localVarQueryParams,
|
||||
localVarCollectionQueryParams,
|
||||
localVarPostBody,
|
||||
localVarHeaderParams,
|
||||
localVarCookieParams,
|
||||
localVarFormParams,
|
||||
localVarAccept,
|
||||
localVarContentType,
|
||||
localVarAuthNames,
|
||||
localVarReturnType
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for BodyApi
|
||||
*/
|
||||
@Ignore
|
||||
public class BodyApiTest {
|
||||
|
||||
private final BodyApi api = new BodyApi();
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetTest() throws ApiException {
|
||||
Pet pet = null;
|
||||
Pet response = api.testEchoBodyPet(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ README.md
|
||||
api/openapi.yaml
|
||||
build.gradle
|
||||
build.sbt
|
||||
docs/BodyApi.md
|
||||
docs/Category.md
|
||||
docs/PathApi.md
|
||||
docs/Pet.md
|
||||
@ -29,6 +30,7 @@ src/main/java/org/openapitools/client/Pair.java
|
||||
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||
src/main/java/org/openapitools/client/ServerVariable.java
|
||||
src/main/java/org/openapitools/client/api/BodyApi.java
|
||||
src/main/java/org/openapitools/client/api/PathApi.java
|
||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
|
||||
|
@ -74,22 +74,21 @@ Please follow the [installation](#installation) instruction and execute the foll
|
||||
|
||||
import org.openapitools.client.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.api.PathApi;
|
||||
import org.openapitools.client.api.BodyApi;
|
||||
|
||||
public class PathApiExample {
|
||||
public class BodyApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
// Configure clients using the `defaultClient` object, such as
|
||||
// overriding the host and port, timeout, etc.
|
||||
PathApi apiInstance = new PathApi(defaultClient);
|
||||
String pathString = "pathString_example"; // String |
|
||||
Integer pathInteger = 56; // Integer |
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||
Pet result = apiInstance.testEchoBodyPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
@ -106,6 +105,8 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**testEchoBodyPetWithHttpInfo**](docs/BodyApi.md#testEchoBodyPetWithHttpInfo) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
*PathApi* | [**testsPathStringPathStringIntegerPathIntegerWithHttpInfo**](docs/PathApi.md#testsPathStringPathStringIntegerPathIntegerWithHttpInfo) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||
|
@ -124,9 +124,37 @@ paths:
|
||||
tags:
|
||||
- query
|
||||
x-accepts: text/plain
|
||||
/echo/body/Pet:
|
||||
post:
|
||||
description: Test body parameter(s)
|
||||
operationId: test/echo/body/Pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Successful operation
|
||||
summary: Test body parameter(s)
|
||||
tags:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
schemas:
|
||||
Category:
|
||||
example:
|
||||
name: Dogs
|
||||
id: 1
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
@ -139,6 +167,9 @@ components:
|
||||
xml:
|
||||
name: category
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
id: 0
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
@ -149,6 +180,21 @@ components:
|
||||
xml:
|
||||
name: tag
|
||||
Pet:
|
||||
example:
|
||||
photoUrls:
|
||||
- photoUrls
|
||||
- photoUrls
|
||||
name: doggie
|
||||
id: 10
|
||||
category:
|
||||
name: Dogs
|
||||
id: 1
|
||||
tags:
|
||||
- name: name
|
||||
id: 0
|
||||
- name: name
|
||||
id: 0
|
||||
status: available
|
||||
properties:
|
||||
id:
|
||||
example: 10
|
||||
|
144
samples/client/echo_api/java/native/docs/BodyApi.md
Normal file
144
samples/client/echo_api/java/native/docs/BodyApi.md
Normal file
@ -0,0 +1,144 @@
|
||||
# BodyApi
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
| [**testEchoBodyPetWithHttpInfo**](BodyApi.md#testEchoBodyPetWithHttpInfo) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
|
||||
|
||||
|
||||
## testEchoBodyPet
|
||||
|
||||
> Pet testEchoBodyPet(pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.models.*;
|
||||
import org.openapitools.client.api.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
Pet result = apiInstance.testEchoBodyPet(pet);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
## testEchoBodyPetWithHttpInfo
|
||||
|
||||
> ApiResponse<Pet> testEchoBodyPet testEchoBodyPetWithHttpInfo(pet)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
### Example
|
||||
|
||||
```java
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.ApiResponse;
|
||||
import org.openapitools.client.Configuration;
|
||||
import org.openapitools.client.models.*;
|
||||
import org.openapitools.client.api.BodyApi;
|
||||
|
||||
public class Example {
|
||||
public static void main(String[] args) {
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
BodyApi apiInstance = new BodyApi(defaultClient);
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
ApiResponse<Pet> response = apiInstance.testEchoBodyPetWithHttpInfo(pet);
|
||||
System.out.println("Status code: " + response.getStatusCode());
|
||||
System.out.println("Response headers: " + response.getHeaders());
|
||||
System.out.println("Response body: " + response.getData());
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
ApiResponse<[**Pet**](Pet.md)>
|
||||
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
| **200** | Successful operation | - |
|
||||
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.ApiResponse;
|
||||
import org.openapitools.client.Pair;
|
||||
|
||||
import org.openapitools.client.model.Pet;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class BodyApi {
|
||||
private final HttpClient memberVarHttpClient;
|
||||
private final ObjectMapper memberVarObjectMapper;
|
||||
private final String memberVarBaseUri;
|
||||
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||
private final Duration memberVarReadTimeout;
|
||||
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
|
||||
private final Consumer<HttpResponse<String>> memberVarAsyncResponseInterceptor;
|
||||
|
||||
public BodyApi() {
|
||||
this(new ApiClient());
|
||||
}
|
||||
|
||||
public BodyApi(ApiClient apiClient) {
|
||||
memberVarHttpClient = apiClient.getHttpClient();
|
||||
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||
memberVarBaseUri = apiClient.getBaseUri();
|
||||
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
|
||||
}
|
||||
|
||||
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||
return new ApiException(response.statusCode(), message, response.headers(), body);
|
||||
}
|
||||
|
||||
private String formatExceptionMessage(String operationId, int statusCode, String body) {
|
||||
if (body == null || body.isEmpty()) {
|
||||
body = "[no body]";
|
||||
}
|
||||
return operationId + " call failed with: " + statusCode + " - " + body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return Pet
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public Pet testEchoBodyPet(Pet pet) throws ApiException {
|
||||
ApiResponse<Pet> localVarResponse = testEchoBodyPetWithHttpInfo(pet);
|
||||
return localVarResponse.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* Test body parameter(s)
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return ApiResponse<Pet>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public ApiResponse<Pet> testEchoBodyPetWithHttpInfo(Pet pet) throws ApiException {
|
||||
HttpRequest.Builder localVarRequestBuilder = testEchoBodyPetRequestBuilder(pet);
|
||||
try {
|
||||
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||
localVarRequestBuilder.build(),
|
||||
HttpResponse.BodyHandlers.ofInputStream());
|
||||
if (memberVarResponseInterceptor != null) {
|
||||
memberVarResponseInterceptor.accept(localVarResponse);
|
||||
}
|
||||
try {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("testEchoBodyPet", localVarResponse);
|
||||
}
|
||||
return new ApiResponse<Pet>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new ApiException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private HttpRequest.Builder testEchoBodyPetRequestBuilder(Pet pet) throws ApiException {
|
||||
|
||||
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||
|
||||
String localVarPath = "/echo/body/Pet";
|
||||
|
||||
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||
|
||||
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||
localVarRequestBuilder.header("Accept", "application/json");
|
||||
|
||||
try {
|
||||
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(pet);
|
||||
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
}
|
||||
if (memberVarReadTimeout != null) {
|
||||
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||
}
|
||||
if (memberVarInterceptor != null) {
|
||||
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||
}
|
||||
return localVarRequestBuilder;
|
||||
}
|
||||
}
|
@ -108,10 +108,9 @@ public class PathApi {
|
||||
throw getApiException("testsPathStringPathStringIntegerPathInteger", localVarResponse);
|
||||
}
|
||||
// for plain text response
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
|
@ -112,10 +112,9 @@ public class QueryApi {
|
||||
throw getApiException("testQueryIntegerBooleanString", localVarResponse);
|
||||
}
|
||||
// for plain text response
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@ -199,10 +198,9 @@ public class QueryApi {
|
||||
throw getApiException("testQueryStyleFormExplodeTrueArrayString", localVarResponse);
|
||||
}
|
||||
// for plain text response
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
@ -284,10 +282,9 @@ public class QueryApi {
|
||||
throw getApiException("testQueryStyleFormExplodeTrueObject", localVarResponse);
|
||||
}
|
||||
// for plain text response
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||
java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A");
|
||||
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
|
@ -15,10 +15,8 @@ package org.openapitools.client;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.api.QueryApi;
|
||||
import org.openapitools.client.model.Category;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||
import org.openapitools.client.api.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@ -31,8 +29,31 @@ import java.util.*;
|
||||
public class CustomTest {
|
||||
|
||||
private final QueryApi api = new QueryApi();
|
||||
private final BodyApi bodyApi = new BodyApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
* <p>
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* @throws ApiException if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPet() throws ApiException {
|
||||
Pet queryObject = new Pet().id(12345L).name("Hello World").
|
||||
photoUrls(Arrays.asList(new String[]{"http://a.com", "http://b.com"})).category(new Category().id(987L).name("new category"));
|
||||
|
||||
Pet p = bodyApi.testEchoBodyPet(queryObject);
|
||||
Assert.assertNotNull(p);
|
||||
Assert.assertEquals("Hello World", p.getName());
|
||||
Assert.assertEquals(Long.valueOf(12345L), p.getId());
|
||||
|
||||
// response is empty body
|
||||
Pet p2 = bodyApi.testEchoBodyPet(null);
|
||||
Assert.assertNull(p2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test query parameter(s)
|
||||
* <p>
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Echo Server API
|
||||
* Echo Server API
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
* Contact: team@openapitools.org
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* API tests for BodyApi
|
||||
*/
|
||||
@Ignore
|
||||
public class BodyApiTest {
|
||||
|
||||
private final BodyApi api = new BodyApi();
|
||||
|
||||
|
||||
/**
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* Test body parameter(s)
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testEchoBodyPetTest() throws ApiException {
|
||||
Pet pet = null;
|
||||
Pet response =
|
||||
api.testEchoBodyPet(pet);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -85,6 +85,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope
|
||||
}
|
||||
|
||||
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
||||
if (parameter == null) return;
|
||||
if (typeof parameter === "object") {
|
||||
if (Array.isArray(parameter)) {
|
||||
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
||||
|
@ -106,11 +106,10 @@ public class AnotherFakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("call123testSpecialTags", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Client>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -104,11 +104,10 @@ public class DefaultApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fooGet", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<FooGetDefaultResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<FooGetDefaultResponse>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<FooGetDefaultResponse>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -115,11 +115,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakeHealthGet", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<HealthCheckResult>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<HealthCheckResult>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<HealthCheckResult>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -279,11 +278,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakeOuterBooleanSerialize", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Boolean>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Boolean>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Boolean>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -353,11 +351,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakeOuterCompositeSerialize", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<OuterComposite>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterComposite>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<OuterComposite>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -427,11 +424,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakeOuterNumberSerialize", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<BigDecimal>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<BigDecimal>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<BigDecimal>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -501,11 +497,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakeOuterStringSerialize", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<String>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -570,11 +565,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("fakePropertyEnumIntegerSerialize", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<OuterObjectWithEnumProperty>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<OuterObjectWithEnumProperty>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<OuterObjectWithEnumProperty>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -903,11 +897,10 @@ public class FakeApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("testClientModel", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Client>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -106,11 +106,10 @@ public class FakeClassnameTags123Api {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("testClassname", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Client>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Client>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Client>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -269,11 +269,10 @@ public class PetApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("findPetsByStatus", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<List<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<List<Pet>>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<List<Pet>>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -354,11 +353,10 @@ public class PetApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("findPetsByTags", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Set<Pet>>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Set<Pet>>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Set<Pet>>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -435,11 +433,10 @@ public class PetApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("getPetById", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Pet>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Pet>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Pet>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -671,11 +668,10 @@ public class PetApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("uploadFile", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<ModelApiResponse>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -748,11 +744,10 @@ public class PetApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("uploadFileWithRequiredFile", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<ModelApiResponse>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<ModelApiResponse>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<ModelApiResponse>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -179,11 +179,10 @@ public class StoreApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("getInventory", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Map<String, Integer>>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Map<String, Integer>>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Map<String, Integer>>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -247,11 +246,10 @@ public class StoreApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("getOrderById", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Order>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -320,11 +318,10 @@ public class StoreApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("placeOrder", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<Order>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<Order>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<Order>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
@ -422,11 +422,10 @@ public class UserApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("getUserByName", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<User>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<User>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<User>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
@ -497,11 +496,10 @@ public class UserApi {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
throw getApiException("loginUser", localVarResponse);
|
||||
}
|
||||
InputStream responseBody = localVarResponse.body();
|
||||
return new ApiResponse<String>(
|
||||
localVarResponse.statusCode(),
|
||||
localVarResponse.headers().map(),
|
||||
responseBody == null || responseBody.available() < 1 ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference<String>() {}) // closes the InputStream
|
||||
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference<String>() {}) // closes the InputStream
|
||||
);
|
||||
} finally {
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user