json object
schema definition
Ioption config object
string | null - if any schema fails it will return string otherwise null.
validate - will compare json object and defined schema
json object
schema definition
Error | null - if value aganist schema fails then return Error otherwise null.
const { validate } = require('@vasuvanka/json-validator')
const jsonValue = { name : "hello world" };
const jsonSchema = { name: { type : String } };
const error = validate(json,jsonSchema, {allowUnkown:false})
if(error){
console.log(`Got error : ${error.message}`)
}
Generated using TypeDoc
ngValidate - validate json object aganist schema defined