Skip to content

Commit 7ed16e4

Browse files
Style
1 parent 598478b commit 7ed16e4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

openapi_python_client/parser/properties/model_property.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ... import schema as oai
88
from ... import utils
99
from ..errors import ParseError, PropertyError
10+
from .enum_property import EnumProperty
1011
from .property import Property
1112
from .schemas import Class, Schemas, parse_reference_path
1213

@@ -49,18 +50,20 @@ def get_imports(self, *, prefix: str) -> Set[str]:
4950

5051

5152
def _is_string_enum(prop: Property) -> bool:
52-
return prop.__class__.__name__ == "EnumProperty" and prop.value_type == str
53+
return isinstance(prop, EnumProperty) and prop.value_type == str
5354

5455

5556
def _is_int_enum(prop: Property) -> bool:
56-
return prop.__class__.__name__ == "EnumProperty" and prop.value_type == int
57+
return isinstance(prop, EnumProperty) and prop.value_type == int
5758

5859

5960
def _is_subtype(first: Property, second: Property) -> bool:
61+
from . import IntProperty, StringProperty
62+
6063
return any(
6164
[
62-
_is_string_enum(first) and second.__class__.__name__ == "StringProperty",
63-
_is_int_enum(first) and second.__class__.__name__ == "IntProperty",
65+
_is_string_enum(first) and isinstance(second, StringProperty),
66+
_is_int_enum(first) and isinstance(second, IntProperty),
6467
_is_string_enum(first)
6568
and _is_string_enum(second)
6669
and set(first.values.items()) <= set(second.values.items()),

0 commit comments

Comments
 (0)