You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
GevatterGaul
changed the title
Schema ignore_key_missing default values
Schema if_key_missing default values
Feb 8, 2015
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.
In the standard schema the value for
if_key_missing
defaults toNoDefault
. This overrides theif_missing
setting for the included validators. So when a validator has anif_missing
setting, this will not be evaluated, as the schema will raise anInvalid
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 theif_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.The text was updated successfully, but these errors were encountered: