We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.validate()
If we have a ListField with items of type models.Base, for example:
ListField
models.Base
from jsonmodels import models, fields class Cat(models.Base): name = fields.StringField(required=True) class Person(models.Base): pets = fields.ListField([Cat])
And we call .validate() on the model:
person = Person(pets=[Cat()]) person.validate()
Then nothing will happen, but if we call .to_struct() on the model:
.to_struct()
person = Person(pets=[Cat()]) person.to_struct()
Then a ValidationError is raised:
ValidationError
>>> jsonmodels.errors.ValidationError: ("Error for field 'name'.", ValidationError('Field is required!'))
Is this working as intended or should the list call .validate() on its items if the item is an instance of a model?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If we have a
ListField
with items of typemodels.Base
, for example:And we call
.validate()
on the model:Then nothing will happen, but if we call
.to_struct()
on the model:Then a
ValidationError
is raised:Is this working as intended or should the list call
.validate()
on its items if the item is an instance of a model?The text was updated successfully, but these errors were encountered: