Turn off automatic skipping of unknown fields
See original GitHub issueWhen loading/deserializing, unknown field names are skipped. It would be nice to be able to raise an error instead, particularly when calling .validate()
. Currently this doesnt seem possible, even with a custom validator, because the field filtering appears to already have occurred by the time the validator gets a hold of it, e.g.
class MySchema:
foo = field.String()
@MySchema.validator
def check_unknown_fields(schema, data):
for k in data:
if k not in schema.fields:
raise ValidationError("Unknown field name: '{}'".format(k))
errors = MySchema().validate({'bar': 'abc'})
doesnt work because data will be an empty {}
by the time check_unknown_fields()
is called.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:10 (9 by maintainers)
Top Results From Across the Web
java - How does serialization tool skip unknown fields during ...
But it cannot manage things like: 1) field name changes (the data will be dropped). 2) class name changes where the target is...
Read more >How to Ignore Unknown Properties While Parsing JSON in ...
Jackson API provides two ways to ignore unknown fields, first at the class level using ... You can solve this problem and prevent...
Read more >Quickstart — marshmallow 3.19.0 documentation
If the unknown option is set to INCLUDE , values with keys corresponding to those fields are therefore loaded with no validation. Specifying...
Read more >MySQL 8.0 Reference Manual :: 17.1.7.3 Skipping Transactions
If replication stops due to an issue with an event in a replicated transaction, you can resume replication by skipping the failed transaction...
Read more >Fields - ent
To read more about how each type is mapped to its database-type, go to the Migration section. ID Field. The id field is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now possible in
3.0.0b12
.https://marshmallow.readthedocs.io/en/3.0/quickstart.html#handling-unknown-fields
Would have been great if setting
strict=True
would actually raise an error on unknown fields.