Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
feat - Show nicer errors if there are extra fields
Browse files Browse the repository at this point in the history
Now you can see which field caused the error.
  • Loading branch information
bebraw committed Jan 28, 2017
1 parent 267a54f commit 197ab81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion schema/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});

module.exports = function validate(schema, data) {
var ajv = new Ajv();
var ajv = new Ajv({
errorDataPath: 'property'
});
var isValid = ajv.validate(schema, data);

if(!isValid) {
Expand Down

0 comments on commit 197ab81

Please sign in to comment.