Last active
May 12, 2020 01:57
-
-
Save AntiKnot/4141d7551e1b6f6d9f167c6eb2e30b9e to your computer and use it in GitHub Desktop.
Validator will not pass extra kv in dict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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