JSON schema validator
Last updated 3 years ago by aboveyou00 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @aboveyou00/json-schema-validator 
SYNC missed versions from official npm registry.

Build Status


This package uses the tv4 JSON Schema validator, and the formats provided by the tv4-formats. It loads all the referenced JSON schemas over the internet to bootstrap tv4.


Validator.simple('http://json-schema.org/geo', function (error, v) {

        {latitude: 53.0, longitude: 43.0},



echo '{"json": "to validate"}' | json-validate http://some.type.id/



v = new Validator(schemaUris);

schemaUris: array of schema Uris to load (can be a string in the case of single URI)


v.fetchSchemas(schemaLoader, callback)

Load schemas over the net with schemaLoader(url, callback) and add to tv4 validator. All URI-s to be loaded: given in constructor and referenced by "$ref" clause in each loaded schema. Circular references get resolved.


v.validate(json, typeId)

Do validation of json against schema defined by typeId

Possible type Ids are:

validate() returns the tv4 validation result object. It will throw an Error if the schema for the passed typeId has not been loaded (fetched).


Validator.simple(uris, callback)

Just a shortcut for getting validator bootstrapped using request as schema loader

Current Tags

  • 1.1.1                                ...           latest (3 years ago)

2 Versions

  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 9
Dependencies (4)
Dev Dependencies (3)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |