RunKit + npm: ajv

node v10.24.1
version: master
endpointsharetweet
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