Open ukrsms opened 2 years ago
I have been banging my head for a few hours because of this.
ignore_extra_keys
, although given to Schema
, is not passed to the Or
and And
described in it. So or:
Or
and And
obtain ignore_extra_keys
value from root Schema
ignore_extra_keys
will be ignored in children classes
For a case when a validator like Or, And etc is used the ignore_extra_keys is taken as false and any extra fields cause a validation error For example: object {"str":"str", "extra":125} is valid for schema {"str":str} and ignore_extra_keys=true but it is not valid for schema Or({"str":str}, None) and ignore_extra_keys=true, however, it should be valid as well
Finally, I understood I needed to set it as Or({"str":str}, None, ignore_extra_keys=true), however, it is not evident enough, so it could be more convenient if Or to use ignore_extra_keys parameter from the Scheme object