Skip to content

Commit da5c8a9

Browse files
Use suggestion
1 parent f0fed56 commit da5c8a9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

openapi_python_client/parser/properties/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,11 @@ def _property_from_data(
407407
if isinstance(data, oai.Reference):
408408
return _property_from_ref(name=name, required=required, nullable=False, data=data, schemas=schemas)
409409

410-
for attribute in ["allOf", "anyOf", "oneOf"]:
411-
sub_data = getattr(data, attribute)
412-
if sub_data and len(sub_data) == 1 and isinstance(sub_data[0], oai.Reference):
413-
return _property_from_ref(
414-
name=name, required=required, nullable=data.nullable, data=sub_data[0], schemas=schemas
415-
)
410+
sub_data = (data.allOf or []) + data.anyOf + data.oneOf
411+
if len(sub_data) == 1 and isinstance(sub_data[0], oai.Reference):
412+
return _property_from_ref(
413+
name=name, required=required, nullable=data.nullable, data=sub_data[0], schemas=schemas
414+
)
416415

417416
if data.enum:
418417
return build_enum_property(

0 commit comments

Comments
 (0)