Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: ajv
node v10.24.1
version:
master
endpoint
share
tweet
var Ajv = require('ajv'); var schema = { definitions: { Data: { // "directives": [], "properties": { "foo": { "type": "string" }, "bar": { "type": "number", "maximum": 3 } } } } }; // var ajv = new Ajv({ // schemas: [schema] // }); var ajv = new Ajv; // REMOVE THIS TO MAKE IT WORK ajv.addKeyword('directives', { // errors: true, // compile: function() { // return function() {return true;} // }, // validate: function() { // return true; // } }) ajv.addSchema(schema); console.log(ajv.validate('#/definitions/Data', { foo: "xx", bar: 2 }))
Created from: https://npm.runkit.com/ajv
Loading…
no comments
sign in
to comment