Skip to content

Instantly share code, notes, and snippets.

@rxon
Created March 24, 2017 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rxon/ce52b411fc8cc8d851b6554d33c9eee9 to your computer and use it in GitHub Desktop.
Save rxon/ce52b411fc8cc8d851b6554d33c9eee9 to your computer and use it in GitHub Desktop.
const schema = {
properties: {
smaller: {
type: 'number',
},
larger: {
type: 'number',
},
},
};
const data = {
smaller: 5,
larger: '1',
};
const Ajv = require('ajv');
const ajv = new Ajv();
const valid = ajv.validate(schema, data);
if (!valid) console.log(ajv.errors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment