Published
Edited
Sep 10, 2018
1 fork
2 stars
Insert cell
Insert cell
Insert cell
schema = ({
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/product.schema.json",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"productId": {
"description": "The unique identifier for a product",
"type": "integer"
},
"productName": {
"description": "Name of the product",
"type": "string"
}
},
"required": [ "productId", "productName" ]
})
Insert cell
data = ({
"productId": "1",
"productName": 2,
"price": false,
"tags": [ "home", "green" ]
})
Insert cell
Insert cell
Insert cell
Insert cell
Ajv = require('https://bundle.run/ajv@6.5.3')
Insert cell
ajv = new Ajv({allErrors: true})
Insert cell
validate = ajv.compile(schema)
Insert cell
valid = validate(data)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more