Skip to content

Instantly share code, notes, and snippets.

@billibala
Last active May 5, 2018 16:04
Show Gist options
  • Save billibala/acc21c450b7b826be1c944b0542e38cd to your computer and use it in GitHub Desktop.
Save billibala/acc21c450b7b826be1c944b0542e38cd to your computer and use it in GitHub Desktop.
JSON validation example
{
"name":"Product name",
"price": 876,
"barcode": "908w839827983742973",
"sku": "hello",
"another": "just a value"
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "",
"type": "object",
"patternProperties": {
"^(price|barcode|sku)$": {
"anyOf":[
{
"type": "string"
},
{
"type":"integer"
}
]
}
},
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment