Skip to content

Releases: ketanSaxena/schema-validator

Adds direct object structure comparison

03 Jun 18:24

Choose a tag to compare

New Features

Compare two objects' schema

If you don't have a schema object built, but you just want to compare if structure of two objects is same, then you can use schemaObj option to pass the expected object:

let person = { name: { first: 'Tom', last: 'Xoman' }, age: 'something' }
let idealPerson = { name: { first: 'Tom', last: 'Xoman' }, age: 45 }
vaidateSchema(person, {    // compares the structure of person object against
  schemaObj: idealPerson   // anotherPerson object.
})

Technical Enhancements

  • Fixes format of the returned errors to fields path and message only
  • npm audit vulnerability fix
  • Externalises printError method