forked from loafle/openapi-generator-original
* deserialize enum json response (python) * adapt python samples: adding enum deserialization * add echo test for enum json response deserialization (python) * update samples
This commit is contained in:
@@ -127,6 +127,7 @@ Class | Method | HTTP request | Description
|
||||
*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body
|
||||
*BodyApi* | [**testEchoBodyStringEnum**](docs/BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body
|
||||
*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s)
|
||||
*FormApi* | [**testFormOneof**](docs/FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
|
||||
@@ -547,6 +547,28 @@ paths:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: text/plain
|
||||
/echo/body/string_enum:
|
||||
post:
|
||||
description: Test string enum response body
|
||||
operationId: test/echo/body/string_enum
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/StringEnumRef'
|
||||
description: String enum
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/StringEnumRef'
|
||||
description: Successful operation
|
||||
summary: Test string enum response body
|
||||
tags:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
/binary/gif:
|
||||
post:
|
||||
description: Test binary (gif) response body
|
||||
|
||||
@@ -12,6 +12,7 @@ All URIs are relative to *http://localhost:3000*
|
||||
| [**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object |
|
||||
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
|
||||
| [**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body |
|
||||
| [**testEchoBodyStringEnum**](BodyApi.md#testEchoBodyStringEnum) | **POST** /echo/body/string_enum | Test string enum response body |
|
||||
| [**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) |
|
||||
|
||||
|
||||
@@ -540,6 +541,72 @@ No authorization required
|
||||
| **200** | Successful operation | - |
|
||||
|
||||
|
||||
## testEchoBodyStringEnum
|
||||
|
||||
> StringEnumRef testEchoBodyStringEnum(body)
|
||||
|
||||
Test string enum response body
|
||||
|
||||
Test string enum response body
|
||||
|
||||
### 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);
|
||||
String body = "body_example"; // String | String enum
|
||||
try {
|
||||
StringEnumRef result = apiInstance.testEchoBodyStringEnum(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling BodyApi#testEchoBodyStringEnum");
|
||||
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 |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **body** | **String**| String enum | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
[**StringEnumRef**](StringEnumRef.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 | - |
|
||||
|
||||
|
||||
## testEchoBodyTagResponseString
|
||||
|
||||
> String testEchoBodyTagResponseString(tag)
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.openapitools.client.ApiClient;
|
||||
|
||||
import java.io.File;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.model.StringEnumRef;
|
||||
import org.openapitools.client.model.Tag;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -398,6 +399,49 @@ public class BodyApi {
|
||||
ParameterizedTypeReference<String> localReturnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI("/echo/body/Pet/response_string", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
|
||||
}
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum (optional)
|
||||
* @return StringEnumRef
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public StringEnumRef testEchoBodyStringEnum(String body) throws RestClientException {
|
||||
return testEchoBodyStringEnumWithHttpInfo(body).getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test string enum response body
|
||||
* Test string enum response body
|
||||
* <p><b>200</b> - Successful operation
|
||||
* @param body String enum (optional)
|
||||
* @return ResponseEntity<StringEnumRef>
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public ResponseEntity<StringEnumRef> testEchoBodyStringEnumWithHttpInfo(String body) throws RestClientException {
|
||||
Object localVarPostBody = body;
|
||||
|
||||
|
||||
final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders localVarHeaderParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<StringEnumRef> localReturnType = new ParameterizedTypeReference<StringEnumRef>() {};
|
||||
return apiClient.invokeAPI("/echo/body/string_enum", HttpMethod.POST, Collections.<String, Object>emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);
|
||||
}
|
||||
/**
|
||||
* Test empty json (request body)
|
||||
* Test empty json (request body)
|
||||
|
||||
Reference in New Issue
Block a user