|
7 | 7 | from ... import schema as oai
|
8 | 8 | from ... import utils
|
9 | 9 | from ..errors import ParseError, PropertyError
|
10 |
| -from .enum_property import EnumProperty |
11 | 10 | from .property import Property
|
12 | 11 | from .schemas import Class, Schemas, parse_reference_path
|
13 | 12 |
|
@@ -59,16 +58,24 @@ def _merge_properties(first: Property, second: Property) -> Union[Property, Prop
|
59 | 58 | if first != second:
|
60 | 59 | return PropertyError(header="Cannot merge properties", detail="Properties has conflicting values")
|
61 | 60 | return first
|
62 |
| - elif first.__class__.__name__ == "StringProperty" and second.__class__ == EnumProperty and second.value_type == str: |
| 61 | + elif ( |
| 62 | + first.__class__.__name__ == "StringProperty" |
| 63 | + and second.__class__.__name__ == "EnumProperty" |
| 64 | + and second.value_type == str |
| 65 | + or first.__class__.__name__ == "IntProperty" |
| 66 | + and second.__class__.__name__ == "EnumProperty" |
| 67 | + and second.value_type == int |
| 68 | + ): |
63 | 69 | second = attr.evolve(second, nullable=nullable, required=required)
|
64 | 70 | return second
|
65 |
| - elif second.__class__.__name__ == "StringProperty" and first.__class__ == EnumProperty and first.value_type == str: |
66 |
| - first = attr.evolve(first, nullable=nullable, required=required) |
67 |
| - return first |
68 |
| - elif first.__class__.__name__ == "IntProperty" and second.__class__ == EnumProperty and second.value_type == int: |
69 |
| - second = attr.evolve(second, nullable=nullable, required=required) |
70 |
| - return second |
71 |
| - elif second.__class__.__name__ == "IntProperty" and first.__class__ == EnumProperty and first.value_type == int: |
| 71 | + elif ( |
| 72 | + second.__class__.__name__ == "StringProperty" |
| 73 | + and first.__class__.__name__ == "EnumProperty" |
| 74 | + and first.value_type == str |
| 75 | + or second.__class__.__name__ == "IntProperty" |
| 76 | + and first.__class__.__name__ == "EnumProperty" |
| 77 | + and first.value_type == int |
| 78 | + ): |
72 | 79 | first = attr.evolve(first, nullable=nullable, required=required)
|
73 | 80 | return first
|
74 | 81 | else:
|
|
0 commit comments