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

Schema if_key_missing default values #77

Open
GevatterGaul opened this issue Feb 8, 2015 · 1 comment
Open

Schema if_key_missing default values #77

GevatterGaul opened this issue Feb 8, 2015 · 1 comment

Comments

@GevatterGaul
Copy link
Contributor

In the standard schema the value for if_key_missing defaults to NoDefault. This overrides the if_missing setting for the included validators. So when a validator has an if_missing setting, this will not be evaluated, as the schema will raise an Invalid exception before.

This behaviour is not documented and the comment to the if_key_missing value in the code suggests that it is also not intended. (schema.py line 52)

I suggest changing the default behaviour for if_key_missing in a way that the if_missing value of the validator can be evaluated. On the other hand, if this behaviour is intended we could document it and save other people the effort of looking it up in the code.

@GevatterGaul GevatterGaul changed the title Schema ignore_key_missing default values Schema if_key_missing default values Feb 8, 2015
@lambacck
Copy link
Contributor

Can you provide a concrete example? I read the code here starting on line 176 as
going with the if_missing value on the validator first and then taking the value of if_key_missing which is then validated using the validator. The code does exactly what is stated on line 52.

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