jjve
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/jjve package

0.5.2 • Public • Published

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).

Package Sidebar

Install

npm i jjve

Weekly Downloads

380

Version

0.5.2

License

MIT

Last publish

Collaborators

  • silas