Skip to content
Prev Previous commit
Next Next commit
Fix bug
  • Loading branch information
forest-benchling committed Jun 28, 2021
commit 70d663a00436cbec363c8a7693518d076e4626d9
10 changes: 7 additions & 3 deletions openapi_python_client/parser/properties/model_property.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from itertools import chain
from typing import ClassVar, Dict, List, NamedTuple, Optional, Set, Tuple, Union
from typing import ClassVar, Dict, List, NamedTuple, Optional, Set, Tuple, Union, cast

import attr

Expand Down Expand Up @@ -69,8 +69,12 @@ def _is_subtype(first: Property, second: Property) -> bool:
[
_is_string_enum(first) and isinstance(second, StringProperty),
_is_int_enum(first) and isinstance(second, IntProperty),
_is_string_enum(first) and _is_string_enum(second) and values_are_subset(first, second),
_is_int_enum(first) and _is_int_enum(second) and values_are_subset(first, second),
_is_string_enum(first) and _is_string_enum(second)
# cast because MyPy fails to deduce type
and values_are_subset(cast(EnumProperty, first), cast(EnumProperty, second)),
_is_int_enum(first) and _is_int_enum(second)
# cast because MyPy fails to deduce type
and values_are_subset(cast(EnumProperty, first), cast(EnumProperty, second)),
]
)

Expand Down