Created
September 25, 2016 00:59
-
-
Save nenodias/bccd993a7d4f561679180c5d9573acba to your computer and use it in GitHub Desktop.
Json Schema Validation
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 jsonschema import validate, FormatChecker | |
checker = FormatChecker() | |
print(dir(checker)) | |
schema = { | |
"type" : "object", | |
"properties" : { | |
"price" : {"type" : "number"}, | |
"name" : {"type" : "string"}, | |
}, | |
} | |
#validate({"name" : "Eggs", "price" : 34.99}, schema, format_checker=checker) | |
validate( | |
{"name" : "Eggs", "price" : 12, 'eita':''}, schema, format_checker=checker | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment