Skip to content
New issue

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

cannot collect all model errors #629

Open
dedominicisfa opened this issue Mar 18, 2022 · 1 comment
Open

cannot collect all model errors #629

dedominicisfa opened this issue Mar 18, 2022 · 1 comment

Comments

@dedominicisfa
Copy link

`from schematics.models import Model
from schematics.types import StringType, FloatType

class schema(Model):
f1 = StringType(choices=['a'])
f2 = FloatType()

sample ={'f1': 'b', 'f2': 'x'}
instance = schema (sample)
instance.validate`

The exception only shows the float error without even initialixing the instance. How do I collect all errors according to documentation?

@dedominicisfa
Copy link
Author

Looking at the library code, I set validate=True in the model construvtor and I collect both errors now. the issue remains that the instance is not created and, if I set f1='a', so it's valid, I'd expect that instance.f1 would be available as 'a'. But as the instance does not initialize, I haven't f1 available even if it is valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant