[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

@@ -9,6 +9,7 @@ import javax.ws.rs.core.GenericType;
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.ArrayList;
@@ -348,6 +349,44 @@ public class BodyApi {
GenericType<String> localVarReturnType = new GenericType<String>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Test string enum response body
* Test string enum response body
* @param body String enum (optional)
* @return a {@code StringEnumRef}
* @throws ApiException if fails to make API call
*/
public StringEnumRef testEchoBodyStringEnum(String body) throws ApiException {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/echo/body/string_enum".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = 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[] { };
GenericType<StringEnumRef> localVarReturnType = new GenericType<StringEnumRef>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Test empty json (request body)
* Test empty json (request body)