[Python] deserialize enum json response (fix #17789) (#17791)

* 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:
Jonathan
2024-02-08 03:52:43 +01:00
committed by GitHub
parent c71eb5dfe8
commit f323a3e788
65 changed files with 3572 additions and 0 deletions

View File

@@ -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&lt;StringEnumRef&gt;
* @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)