-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Multiple validators for an attribute #138
Comments
👍 I was surprised this didn't "just work" when I tried it, honestly. |
this is a duplicate of #13. we’re still trying to come up with something really good and lasting. It seems like this road leads to re-implementing a validation framework which seems like a waste of time. |
Yes, #13 looks similar. But a accepting a simple list of validators looks cleaner to me |
You’re right, I’ve added it. A bigger solution is coming but this can be achieved w/o external dependencies. |
👍 |
For those that get this via Googling: https://www.attrs.org/en/stable/api.html#attr.ib tl;dr: passing a list of validators now works (since 17.1.0) |
It would be very handy to be able to validate an attribute against a list of validators.
This way they can be composed easily
Eg :
validator: [instanceof(float), max(2), min(0)]
The text was updated successfully, but these errors were encountered: