question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Turn off automatic skipping of unknown fields

See original GitHub issue

When 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:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

8reactions
sloriacommented, Jul 5, 2018
8reactions
norbertpycommented, Mar 13, 2017

Would have been great if setting strict=True would actually raise an error on unknown fields.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found