Various JSON schemas for ILP-related protocols
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
schemas
.eslintignore
.eslintrc
.gitignore
.npmignore
CONTRIBUTING.md
LICENSE
README.md
circle.yml
index.js
npmrc-env
package-lock.json
package.json

README.md

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