Skip to content

Instantly share code, notes, and snippets.

@nenodias
Created September 25, 2016 00:59
Show Gist options
  • Save nenodias/bccd993a7d4f561679180c5d9573acba to your computer and use it in GitHub Desktop.
Save nenodias/bccd993a7d4f561679180c5d9573acba to your computer and use it in GitHub Desktop.
Json Schema Validation
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