Skip to content

Commit b5fa15d

Browse files
Address suggestions
1 parent 8a72732 commit b5fa15d

File tree

6 files changed

+4
-6
lines changed

6 files changed

+4
-6
lines changed

end_to_end_tests/golden-record-custom/custom_e2e/models/model_with_union_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _parse_a_property(data: object) -> Union[Unset, AnEnum, AnIntEnum]:
4545
if isinstance(data, Unset):
4646
return data
4747
try:
48-
if not isinstance(data, int):
48+
if not isinstance(data, str):
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data

end_to_end_tests/golden-record-custom/custom_e2e/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def __bool__(self) -> bool:
1111

1212
UNSET: Unset = Unset()
1313

14-
# Used as `FileProperty._json_type_string`
1514
FileJsonType = Tuple[Optional[str], Union[BinaryIO, TextIO], Optional[str]]
1615

1716

end_to_end_tests/golden-record/my_test_api_client/models/model_with_union_property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _parse_a_property(data: object) -> Union[Unset, AnEnum, AnIntEnum]:
4545
if isinstance(data, Unset):
4646
return data
4747
try:
48-
if not isinstance(data, int):
48+
if not isinstance(data, str):
4949
raise TypeError()
5050
a_property = UNSET
5151
_a_property = data

end_to_end_tests/golden-record/my_test_api_client/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def __bool__(self) -> bool:
1111

1212
UNSET: Unset = Unset()
1313

14-
# Used as `FileProperty._json_type_string`
1514
FileJsonType = Tuple[Optional[str], Union[BinaryIO, TextIO], Optional[str]]
1615

1716

openapi_python_client/templates/property_templates/enum_property.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{ construct_template(construct_function, property, source, initial_value=initial_value) }}
99
{% endmacro %}
1010

11-
{% macro check_type_for_construct(property, source) %}{% if property.value_type == str %}isinstance({{ source }}, str){% else %}isinstance({{ source }}, int){% endif %}{% endmacro %}
11+
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, {{ property.value_type.__name__ }}){% endmacro %}
1212

1313
{% macro transform(property, source, destination, declare_type=True) %}
1414
{% if property.required %}

openapi_python_client/templates/types.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Unset:
1111

1212
UNSET: Unset = Unset()
1313

14-
# Used as `FileProperty._json_type_string`
14+
{# Used as `FileProperty._json_type_string` #}
1515
FileJsonType = Tuple[Optional[str], Union[BinaryIO, TextIO], Optional[str]]
1616

1717

0 commit comments

Comments
 (0)