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

Passing additional validators #24

Open
GeorgeLubaretsi opened this issue Sep 16, 2018 · 1 comment
Open

Passing additional validators #24

GeorgeLubaretsi opened this issue Sep 16, 2018 · 1 comment

Comments

@GeorgeLubaretsi
Copy link

init_validator intializer that is called in declared fields accepts additional_validators, but it's not exposed in built-in fields. It would be nice to have that exposed.

I created custom fields that accepts list of validators that is passed to the validators composer and subsequently to the attr which works fine for required fields, but when the field is optional, validators.optional is called with the _CompositeValidator object, which contains validators as a tuple, but validators.optional only checks if the validators is type of list.

It's not very easy to override the composer, so perhaps it's a good idea to make it extensible too. Additional benefits would be that we can use composed functions for field converters too

@Valian
Copy link

Valian commented Oct 2, 2018

I also have this problem. There is no easy way to pass additional_validatators to fields, potentially a very simple fix. @imaurer what is your opinion?

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

2 participants