ilp-schemas
v2.0.0
Published
Various JSON schemas for ILP-related protocols
Downloads
8
Maintainers
Readme
ILP Schemas
JSON Schemas describing various ILP related protocols and formats.
Installation
npm install --save ilp-schemas
Schema Validator
This module does not contain a schema validator. We recommend using an open-source validator like ajv.
const schemas = require('ilp-schemas')
const Ajv = require('ajv')
// create validator
const ajv = new Ajv()
// add all schemas
Object.keys(schemas).forEach(name => ajv.addSchema(schemas[name], name))
// validate something
const isValid = ajv.validate('Transfer.json', myTransfer)
if (isValid) {
console.info('all good!')
} else {
console.error('not a valid transfer!')
console.error(ajv.errors)
}