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 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 gvoysey commented Jan 31, 2017

👍

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

@hynek
Copy link
Member

@hynek 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 Feb 4, 2017
@cbornet
Copy link
Author

@cbornet 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 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 cbornet commented Feb 4, 2017

👍

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

@nicktimko nicktimko commented Jul 15, 2021

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants