作者:一滴水 | 来源:互联网 | 2023-10-12 16:20
Not sure if by design but combining load_from and required=True results in validation failing.
1 2 3 4 5 6 7 8 9 10
| class UserSchema(Schema):
name = fields.String()
email = fields.Email(load_from='emailAddress', required=True)
data = {
'name': 'Mike',
'emailAddress': 'foo.com'
}
s = UserSchema()
result, errors = s.load(data) |
{'email': [u'Missing data for required field.']}
该提问来源于开源项目:marshmallow-code/marshmallow
Ah...
Sorry to waste your time.