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

Add option to fail on unexpected fields #515

Closed
maxgrenderjones opened this issue Aug 19, 2016 · 1 comment
Closed

Add option to fail on unexpected fields #515

maxgrenderjones opened this issue Aug 19, 2016 · 1 comment

Comments

@maxgrenderjones
Copy link

Per the docs:

Normally, unspecified field names are ignored by the validator. If you would like access to the original, raw input (e.g. to fail validation if an unknown field name is sent), add pass_original=True to your call to validates_schema.

If I'm trying to use marshmallow to do validation that the input is what I expect and I want to fail if I get unexpected data, is there really no way to have it fail without writing your own validator? (Apologies if I'm just missing something obvious in the docs - this seems very surprising as someone new to marshmallow).

If not, feature request: please could you add a fail_on_unexpected flag to accompany strict (which would have to default to False for backwards compatibility reasons? (I guess strict is some combination of hypothetical fail_on_missing and validate keywords?)

@sloria
Copy link
Member

sloria commented Oct 5, 2016

Let's continue discussion of this in #524

@sloria sloria closed this as completed Oct 5, 2016
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