Skip to content

Commit 1dd1efe

Browse files
committed
Add processing of object default if present, fallback to old behavior if absent
1 parent b013093 commit 1dd1efe

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: openapi_python_client/parser/properties/__init__.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,18 @@ def _property_from_ref(
120120
schemas,
121121
)
122122

123-
default = existing.convert_value(parent.default) if parent is not None else None
124-
if isinstance(default, PropertyError):
125-
default.data = parent or data
126-
return default, schemas
123+
if hasattr(data, 'default'):
124+
default = existing.convert_value(data.default)
125+
if isinstance(default, PropertyError):
126+
default.data = data
127+
return default, schemas
128+
elif parent is not None:
129+
default = existing.convert_value(parent.default)
130+
if isinstance(default, PropertyError):
131+
default.data = parent
132+
return default, schemas
133+
else:
134+
default = None
127135

128136
prop = evolve(
129137
existing,

0 commit comments

Comments
 (0)