Skip to content
Open
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 @@ -318,7 +318,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb
# process the path parameters
{{#pathParams}}
if {{paramName}} is not None:
_path_params['{{baseName}}'] = {{paramName}}{{#isEnumRef}}.value{{/isEnumRef}}
_path_params['{{baseName}}'] = {{paramName}}
{{/pathParams}}
# process the query parameters
{{#queryParams}}
Expand Down Expand Up @@ -378,7 +378,7 @@ https://github.com/OpenAPITools/openapi-generator/blob/c84b949df1a9ec04ba75989cb
{{/isModel}}
{{^isMap}}
{{^isModel}}
_query_params.append(('{{baseName}}', {{paramName}}{{#isEnumRef}}.value{{/isEnumRef}}))
_query_params.append(('{{baseName}}', {{paramName}}))
{{/isModel}}
{{/isMap}}
{{/isDate}}{{/isDateTime}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_
if enum_nonref_string_path is not None:
_path_params['enum_nonref_string_path'] = enum_nonref_string_path
if enum_ref_string_path is not None:
_path_params['enum_ref_string_path'] = enum_ref_string_path.value
_path_params['enum_ref_string_path'] = enum_ref_string_path
# process the query parameters
# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _test_enum_ref_string_serialize(

if enum_ref_string_query is not None:

_query_params.append(('enum_ref_string_query', enum_ref_string_query.value))
_query_params.append(('enum_ref_string_query', enum_ref_string_query))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def _tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_
if enum_nonref_string_path is not None:
_path_params['enum_nonref_string_path'] = enum_nonref_string_path
if enum_ref_string_path is not None:
_path_params['enum_ref_string_path'] = enum_ref_string_path.value
_path_params['enum_ref_string_path'] = enum_ref_string_path
# process the query parameters
# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _test_enum_ref_string_serialize(

if enum_ref_string_query is not None:

_query_params.append(('enum_ref_string_query', enum_ref_string_query.value))
_query_params.append(('enum_ref_string_query', enum_ref_string_query))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def _fake_enum_ref_query_parameter_serialize(
# process the query parameters
if enum_ref is not None:

_query_params.append(('enum_ref', enum_ref.value))
_query_params.append(('enum_ref', enum_ref))

# process the header parameters
# process the form parameters
Expand Down
12 changes: 12 additions & 0 deletions samples/openapi3/client/petstore/python/tests/test_fake_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,15 @@ def testTopLevelEnumJson(self):
):
returned = self.fake_api.fake_return_enum()
self.assertEqual("a", returned)

def testEnumRefQueryParameterAcceptsEnumOrValue(self):
"""An enum reference query parameter serializes the same as the enum or its value"""
for enum_ref in (petstore_api.EnumClass.MINUS_EFG, "-efg"):
_, url, _, _, _ = self.fake_api._fake_enum_ref_query_parameter_serialize(
enum_ref=enum_ref,
_request_auth=None,
_content_type=None,
_headers=None,
_host_index=0,
)
self.assertTrue(url.endswith("?enum_ref=-efg"), url)
Loading