0.5.2 • Published 7 years ago

jjve v0.5.2

Weekly downloads
392
License
MIT
Repository
github
Last release
7 years ago

JJV Errors (jjve) Build Status

This is a library to render JJV validation output.

Usage

var jjv = require('jjv');
var jjve = require('jjve');

var env = jjv();
var je = jjve(env);

var schema = {
  type: 'object',
  properties: { ok: { type: 'boolean' } },
};

var data = { ok: 1 };

var result = env.validate(schema, data);

if (result) {
  var errors = je(schema, data, result);
  console.log(JSON.stringify(errors, null, 4));
}

Output

[
    {
        "code": "INVALID_TYPE",
        "message": "Invalid type: integer should be boolean",
        "data": 1,
        "path": "$.ok"
    }
]

License

This work is licensed under the MIT License (see the LICENSE file).

Error messages derived from z-schema (see the NOTICE file).