You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current implementation of validation raises the jsonmodels.errors.ValidationError as soon as the first error is encountered.
>>>fromjsonmodelsimportmodels, fields, validators>>>classPerson(models.Base):
... name=fields.StringField(required=True, validators=validators.Length(1))
... age=fields.IntField(required=True, validators=[validators.Min(14)])
...
>>>p=Person()
>>>p.validate()
Traceback (mostrecentcalllast):
...
jsonmodels.errors.ValidationError: ("Error for field 'age'.", ValidationError('Field is required!',))
That means there's no way to get an overview of all validation errors for particular model, which is essential for complex data models.
It would be great to have complete model validation errors, with complete list of the errors per each field. In above example, that could be
jsonmodels.errors.ValidationError: {'name': ['Field is required'], 'age': ['Field is required']}
That should work for embedded fields as well.
It is an open question, whether all validator for particular field should be executed or if inclusion of the first validation error for particular field is enough.
The text was updated successfully, but these errors were encountered:
Current implementation of validation raises the
jsonmodels.errors.ValidationError
as soon as the first error is encountered.That means there's no way to get an overview of all validation errors for particular model, which is essential for complex data models.
It would be great to have complete model validation errors, with complete list of the errors per each field. In above example, that could be
That should work for embedded fields as well.
It is an open question, whether all validator for particular field should be executed or if inclusion of the first validation error for particular field is enough.
The text was updated successfully, but these errors were encountered: