Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
handle Record
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca committed Apr 24, 2021
1 parent 3d4353b commit 01aca3d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openapi/data/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from multidict import MultiDict

from openapi import json
from openapi.types import Record

from ..utils import TypingInfo
from .fields import (
Expand Down Expand Up @@ -198,7 +199,7 @@ def validate_dict(

def validate_dataclass(
schema: type,
data: Union[Dict[str, Any], MultiDict],
data: Union[Dict[str, Any], MultiDict, Record],
*,
strict: bool = True,
multiple: bool = False,
Expand All @@ -208,7 +209,7 @@ def validate_dataclass(
errors: Dict = {}
cleaned: Dict = {}
try:
data = MultiDict(data)
data = MultiDict(dict(data) if isinstance(data, Record) else data)
except TypeError:
raise ValidationErrors(OBJECT_EXPECTED)
for field in fields(schema):
Expand Down

0 comments on commit 01aca3d

Please sign in to comment.