ilp-schemas

2.0.0 • Public • Published

ILP Schemas npm circle

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)
}

Package Sidebar

Install

npm i ilp-schemas

Weekly Downloads

1

Version

2.0.0

License

Apache-2.0

Last publish

Collaborators

  • interledger