fix: handle discriminated model with root definition

This commit is contained in:
Georg K
2023-02-09 12:25:28 +03:00
parent be944ac98e
commit 26fd6fa19f
2 changed files with 39 additions and 2 deletions

View File

@@ -68,7 +68,10 @@ class BodyGetter(AbstractInjector):
def __init__(self, args_spec: dict, default_values: dict):
self.arg_name, self.model = next(iter(args_spec.items()))
self._expect_object = self.model.schema()["type"] == "object"
schema = self.model.schema()
if "type" not in schema:
schema["type"] = "object"
self._expect_object = schema["type"] == "object"
async def inject(self, request: BaseRequest, args_view: list, kwargs_view: dict):
try: