You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exposes Agent, as well as Schema and Validator for further configuration.
Installation
component:
$ component install ericgj/json-schema-suite
npm:
$ npm install json-schema-suite
browser standalone:
Include build.js or build.min.js in a script tag.
This will give you a window.jsonSchema global.
If you would prefer a different global, clone this repo and rebuild like:
Then move the build/build.js file into your project.
Examples
varsuite=require('json-schema-suite')// Simple validation// see json-schema-valid for more detailsvarvalidator=newsuite.Validator()validator.validateRaw(schema,instance);// booleanvalidator.error();// validation error(s) wrapped in error object// HTTP correlationvaragent=newsuite.Agent()agent.get('/api',function(err,correlation){// validationcorrelation.once('error',function(e){console.error(e);})if(correlation.validate()){//...}// follow resolved links in correlationsagent.follow(correlation.rel('instances'),function(){//...});})