Skip to content

Instantly share code, notes, and snippets.

@AntiKnot
Last active May 12, 2020 01:57
Show Gist options
  • Select an option

  • Save AntiKnot/4141d7551e1b6f6d9f167c6eb2e30b9e to your computer and use it in GitHub Desktop.

Select an option

Save AntiKnot/4141d7551e1b6f6d9f167c6eb2e30b9e to your computer and use it in GitHub Desktop.
Validator will not pass extra kv in dict
from cerberus import Validator
schema = {'a': {'type': 'string'}}
data = {'a': '1', 'b': None}
if __name__ == '__main__':
v = Validator()
if not v.validate(data, schema):
print(v.errors)
v.allow_unknown = True
if not v.validate(data, schema):
print(v.errors)
print(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment