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.

Allow setting a global unknown setting

See original GitHub issue

The new RAISE unknown setting can make the migration pretty painful, especially for those who are just fine with EXCLUDEing unknown keys. What about making this global default a configuration setting?

Something as simple as:

import marshmallow

marshmallow.DEFAULT_UNKNOWN_BEHAVIOR = marshmallow.EXCLUDE

I know it’s possible to subclass Schema, but that seems more heavy-handed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

deckar01commented, Aug 26, 2019

You can modify the base schema’s Meta class directly and your subclasses will inherit it.

from marshmallow import Schema, fields, EXCLUDE

Schema.Meta.unknown = EXCLUDE

class Test(Schema):
    foo = fields.Str()

Test().load({'foo': 'test', 'junk': 2})
# {'foo': 'test'}
lafrechcommented, Apr 16, 2021

It should work. Could you please provide a repro case?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow App Installations from Unknown Sources - Samsung
Navigate: Settings Settings icon. Apps . ; Tap. Menu icon. (upper-right). ; Tap. Special access . ; Tap. Install unknown apps . ;...
Read more >
Allow "unknown sources" from Terminal without going to ...
Under APPS, tap Settings Storage → settings.db → global. Tap install_non_market_apps → click pencil icon (at the top) to edit it and change...
Read more >
git commit --author doesn't work when global not set
1 by issuing git config "" and git config "Bogus" Until I did that, it would not accept any ...
Read more >
Galaxy phone or tablet won't install apps from unknown sources
Navigate to Install unknown apps. ... Navigate to Settings. Search for and select Install unknown apps. Then, tap Install unknown apps again. Allow...
Read more >
Corporate-owned Android Enterprise device restriction ...
Android Enterprise device settings list to allow or restrict features on corporate-owned devices using Intune.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found