Created
March 24, 2017 13:22
-
-
Save rxon/ce52b411fc8cc8d851b6554d33c9eee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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