Add JSON Schema validation

This commit is contained in:
Ivan Paolillo
2016-06-21 18:02:14 +02:00
parent 737848c9be
commit 3d0b89a66a
6 changed files with 139 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"id": 1,
"name": "Lampshade",
"price": 0
}
+22
View File
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product",
"description": "A product from the catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"name": {
"description": "Name of the product",
"type": "string"
},
"price": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
}
},
"required": ["id", "name", "price"]
}