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

Feature: member_validator accepting lists of validators #577

Closed
trendelkampschroer opened this issue Sep 24, 2019 · 1 comment
Closed

Feature: member_validator accepting lists of validators #577

trendelkampschroer opened this issue Sep 24, 2019 · 1 comment
Labels

Comments

@trendelkampschroer
Copy link

First of all thanks a lot for creating this project.

I have a feature request, that other attrs users might also find useful.

attr.ib supports passing lists of validators, e.g. attr.ib(validators=[validator_foo, validator_bar]) instead of using the and_ validator.

This is not the case for deep_iterable(member_validator=...). To check 'foo' and 'bar' for each element in an iterable I currently need to use
deep_iterable(member_validator=and_(validator_foo, validator_bar)) which I find less readable than
deep_iterable(member_validator=[validator_foo, validator_bar])

I'm not sure if it is possible to add the same syntactic sugar to member_validator, but if so I think it would improve the new deep_iterable validators. Especially for validating nested iterables.

@wbolster
Copy link
Member

i believe this has been fixed by #925

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

No branches or pull requests

3 participants