SerializableSchema should check if its values can be serialized, so that it doesn't break when used in a union with a base type or schema that isn't a SerializableSchema
This commit is contained in:
parent
058ff148cf
commit
d0d18fcae2
1 changed files with 1 additions and 1 deletions
|
@ -41,7 +41,7 @@ class SerializableSchema(Schema):
|
|||
@classmethod
|
||||
def _run_root_validator(cls, values: Any, handler: ModelWrapValidatorHandler[Schema], info: ValidationInfo) -> Any:
|
||||
""" overwriting this, we need to call serialize to get the correct data """
|
||||
if not isinstance(values, dict):
|
||||
if hasattr(values, 'serialize') and callable(values.serialize):
|
||||
values = values.serialize()
|
||||
return handler(values)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue