Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Fix exception in request body with enum ref #17438

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,7 @@ private PythonType getType(CodegenParameter cp) {
// TODO process the first one only at the moment
if (cmt != null)
// TODO: don't loop back to the deprecated getPydanticType method
result = getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname);
return getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname);
}
throw new RuntimeException("Error! Failed to process getPydanticType when getting the content: " + cp);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ class {{classname}}:
{{/servers.0}}

_collection_formats: Dict[str, str] = {
{{#allParams}}{{#isArray}}
'{{baseName}}': '{{collectionFormat}}',{{/isArray}}{{/allParams}}
{{#allParams}}
{{#isArray}}
'{{baseName}}': '{{collectionFormat}}',
{{/isArray}}
{{/allParams}}
}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,19 @@ paths:
type: array
items:
$ref: "#/components/schemas/ListOfObjects"
/fake/ref_enum_string:
get:
tags:
- fake
summary: test ref to enum string
operationId: fake_ref_enum_string
responses:
200:
description: OK
content:
plain/text:
schema:
$ref: "#/components/schemas/EnumClass"
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def _test_auth_http_basic_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -483,7 +482,6 @@ def _test_auth_http_bearer_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def _test_binary_gif_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -503,7 +502,6 @@ def _test_body_application_octetstream_binary_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -779,7 +777,6 @@ def _test_body_multipart_formdata_array_of_binary_serialize(
_host = None

_collection_formats: Dict[str, str] = {

'files': 'csv',
}

Expand Down Expand Up @@ -1051,7 +1048,6 @@ def _test_echo_body_all_of_pet_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1322,7 +1318,6 @@ def _test_echo_body_free_form_object_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1593,7 +1588,6 @@ def _test_echo_body_pet_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1864,7 +1858,6 @@ def _test_echo_body_pet_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -2135,7 +2128,6 @@ def _test_echo_body_tag_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def _test_form_integer_boolean_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -622,7 +621,6 @@ def _test_form_oneof_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ def _test_header_integer_boolean_string_enums_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def _test_enum_ref_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -564,7 +563,6 @@ def _test_query_datetime_date_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -876,7 +874,6 @@ def _test_query_integer_boolean_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1144,7 +1141,6 @@ def _test_query_style_deep_object_explode_true_object_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1404,7 +1400,6 @@ def _test_query_style_deep_object_explode_true_object_all_of_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1664,7 +1659,6 @@ def _test_query_style_form_explode_true_array_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1924,7 +1918,6 @@ def _test_query_style_form_explode_true_object_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -2184,7 +2177,6 @@ def _test_query_style_form_explode_true_object_all_of_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
2 changes: 0 additions & 2 deletions samples/client/echo_api/python/openapi_client/api/auth_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def _test_auth_http_basic_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -483,7 +482,6 @@ def _test_auth_http_bearer_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
8 changes: 0 additions & 8 deletions samples/client/echo_api/python/openapi_client/api/body_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def _test_binary_gif_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -503,7 +502,6 @@ def _test_body_application_octetstream_binary_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -779,7 +777,6 @@ def _test_body_multipart_formdata_array_of_binary_serialize(
_host = None

_collection_formats: Dict[str, str] = {

'files': 'csv',
}

Expand Down Expand Up @@ -1051,7 +1048,6 @@ def _test_echo_body_all_of_pet_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1322,7 +1318,6 @@ def _test_echo_body_free_form_object_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1593,7 +1588,6 @@ def _test_echo_body_pet_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1864,7 +1858,6 @@ def _test_echo_body_pet_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -2135,7 +2128,6 @@ def _test_echo_body_tag_response_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
2 changes: 0 additions & 2 deletions samples/client/echo_api/python/openapi_client/api/form_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def _test_form_integer_boolean_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -622,7 +621,6 @@ def _test_form_oneof_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ def _test_header_integer_boolean_string_enums_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def _test_enum_ref_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -564,7 +563,6 @@ def _test_query_datetime_date_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -876,7 +874,6 @@ def _test_query_integer_boolean_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1144,7 +1141,6 @@ def _test_query_style_deep_object_explode_true_object_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1404,7 +1400,6 @@ def _test_query_style_deep_object_explode_true_object_all_of_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1664,7 +1659,6 @@ def _test_query_style_form_explode_true_array_string_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -1924,7 +1918,6 @@ def _test_query_style_form_explode_true_object_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down Expand Up @@ -2184,7 +2177,6 @@ def _test_query_style_form_explode_true_object_all_of_serialize(
_host = None

_collection_formats: Dict[str, str] = {

}

_path_params: Dict[str, str] = {}
Expand Down
Loading
Loading