Skip to content

Commit 95af369

Browse files
committed
AnyUnmarshaller use allOf schemas
1 parent 667795d commit 95af369

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

openapi_core/unmarshalling/schemas/unmarshallers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ def __call__(self, value=NoValue):
253253
if one_of_schema:
254254
return self.unmarshallers_factory.create(one_of_schema)(value)
255255

256+
all_of_schema = self._get_all_of_schema(value)
257+
if all_of_schema:
258+
return self.unmarshallers_factory.create(all_of_schema)(value)
259+
256260
for schema_type in self.SCHEMA_TYPES_ORDER:
257261
unmarshaller = self.unmarshallers_factory.create(
258262
self.schema, type_override=schema_type)
@@ -278,3 +282,17 @@ def _get_one_of_schema(self, value):
278282
continue
279283
else:
280284
return subschema
285+
286+
def _get_all_of_schema(self, value):
287+
if not self.schema.all_of:
288+
return
289+
for subschema in self.schema.all_of:
290+
if subschema.type == SchemaType.ANY:
291+
continue
292+
unmarshaller = self.unmarshallers_factory.create(subschema)
293+
try:
294+
unmarshaller.validate(value)
295+
except ValidateError:
296+
continue
297+
else:
298+
return subschema

0 commit comments

Comments
 (0)