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

ignore_extra_keys is ignored if flavor == VALIDATOR #285

Open
ukrsms opened this issue Aug 17, 2022 · 1 comment
Open

ignore_extra_keys is ignored if flavor == VALIDATOR #285

ukrsms opened this issue Aug 17, 2022 · 1 comment

Comments

@ukrsms
Copy link

ukrsms commented Aug 17, 2022

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

@ukrsms ukrsms closed this as completed Aug 17, 2022
@ukrsms ukrsms closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2022
@ukrsms ukrsms reopened this Aug 17, 2022
@elavaud
Copy link

elavaud commented Sep 29, 2022

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:

  • Feature request: Or and And obtain ignore_extra_keys value from root Schema
  • If this is the intended behavior, doc request: explicitly say that ignore_extra_keys will be ignored in children classes

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