jsond-validator

JSOND Validator

Usage no npm install needed!

<script type="module">
  import jsondValidator from 'https://cdn.skypack.dev/jsond-validator';
</script>

README

JSOND Validator

node.js and browser module for validating JSON definitions

Travis CI Sauce Test Status Sauce Test Status Code Coverage Dependencies

A validator for JSON definitions according to the JSOND specification with the following exceptions:

  • Array items are matched only against the first array definition in the schema (see test/data/array.js for missing test cases)

Documentation

http://avaly.github.io/jsond-validator

Usage

yarn add jsond-validator

OR

npm install jsond-validator

Then:

const validator = require('jsond-validator');

The package also ships with two UMD bundles:

  • dist/jsond-validator.js
  • dist/jsond-validator.min.js

Tools

A simple script is shipped with this module to verify a JSON file against a JSON schema:

validate-jsond INPUT_FILE SCHEMA_FILE

Development

npm run test
npm run test-client

License

Copyright (c) 2015-2017, Valentin Agachi (http://agachi.name)

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.