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

Multiple validators for an attribute #138

Closed
cbornet opened this issue Jan 24, 2017 · 6 comments
Closed

Multiple validators for an attribute #138

cbornet opened this issue Jan 24, 2017 · 6 comments

Comments

@cbornet
Copy link

cbornet commented Jan 24, 2017

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)]

@gvoysey
Copy link

gvoysey commented Jan 31, 2017

👍

I was surprised this didn't "just work" when I tried it, honestly.

@hynek
Copy link
Member

hynek commented Feb 4, 2017

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.

@hynek hynek closed this as completed Feb 4, 2017
@cbornet
Copy link
Author

cbornet commented Feb 4, 2017

Yes, #13 looks similar. But a accepting a simple list of validators looks cleaner to me

hynek added a commit that referenced this issue Feb 4, 2017
@hynek
Copy link
Member

hynek commented Feb 4, 2017

You’re right, I’ve added it. A bigger solution is coming but this can be achieved w/o external dependencies.

@cbornet
Copy link
Author

cbornet commented Feb 4, 2017

👍

@hynek hynek mentioned this issue May 10, 2017
6 tasks
@nicktimko
Copy link
Contributor

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)

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

No branches or pull requests

4 participants