JSPM

ajv

0.0.10
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 170612464
  • Score
    100M100P100Q237096F
  • License MIT

Another JSON schema Validator

Package Exports

  • ajv
  • ajv/lib/ajv
  • ajv/lib/compile/formats
  • ajv/lib/compile/formats.js
  • ajv/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ajv) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ajv - Another JSON schema Validator

TODO

  • refs (internal, remote with addSchema)
  • custom formats (via options)
  • schema validation before compilation
  • bundle compiled templates (doT will be dev dependency)

Install

npm install ajv

Usage

var ajv = require('ajv')(options);
var validate = ajv.compile(schema);
var result = validate(data);

or

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

Compiles and caches in both cases, so that the next time the same schema is used (not necessarily the same object instance) it won't be compiled again.

Options

  • allErrors: if true, jv will continue validating all rules collecting all errors (false by default)
  • verbose: include the reference to the validated data in the errors (false by default)
  • format: if false, the formats won't be validated (true by default)
  • unicode: if false, the lengths of strings with unicode pairs will be incorrect (true by default)