-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace tv4 with is-my-json-valid #40
Comments
my tmp clipboard: var validator = require('is-my-json-valid');
var ext = {
type: 'number'
};
var validate = validator({
type: 'object',
properties: {
hello: {
type: 'string',
format: 'only-a'
},
hello2: {
'$ref': '/other'
}
},
required: ['hello', 'hello2']
}, {
schemas: {
'/other2': ext
},
formats: {
// 'only-a': /^a+$/
'only-a': function (data) {
if (data.indexOf('b') >= 0) {
return false;
}
return true;
}
},
verbose: true,
greedy: true
});
console.log(validate({ hello: 'aa', hello2: 3 })); // true
console.log(validate.errors);
console.log(validate.missing);
console.log(validate({ hello: 'ab' })); // false
console.log(validate.errors); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wait for: mafintosh/is-my-json-valid#38 (comment) and mafintosh/is-my-json-valid#43 and mafintosh/is-my-json-valid#46
The text was updated successfully, but these errors were encountered: