[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

@@ -21,6 +21,7 @@ import org.openapitools.client.Pair;
import java.io.File;
import org.openapitools.client.model.Pet;
import org.openapitools.client.model.StringEnumRef;
import org.openapitools.client.model.Tag;
@@ -612,6 +613,75 @@ public class BodyApi {
);
}
/**
* Test string enum response body
* Test string enum response body
* @param body String enum (optional)
* @return StringEnumRef
* @throws ApiException if fails to make API call
*/
public StringEnumRef testEchoBodyStringEnum(String body) throws ApiException {
return this.testEchoBodyStringEnum(body, Collections.emptyMap());
}
/**
* Test string enum response body
* Test string enum response body
* @param body String enum (optional)
* @param additionalHeaders additionalHeaders for this call
* @return StringEnumRef
* @throws ApiException if fails to make API call
*/
public StringEnumRef testEchoBodyStringEnum(String body, Map<String, String> additionalHeaders) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/echo/body/string_enum";
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
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>();
localVarHeaderParams.putAll(additionalHeaders);
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<StringEnumRef> localVarReturnType = new TypeReference<StringEnumRef>() {};
return apiClient.invokeAPI(
localVarPath,
"POST",
localVarQueryParams,
localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(),
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType
);
}
/**
* Test empty json (request body)
* Test empty json (request body)