https://github.com/interledger-deprecated/ilp-schemas
Various JSON schemas for ILP-related protocols
https://github.com/interledger-deprecated/ilp-schemas
Last synced: 5 months ago
JSON representation
Various JSON schemas for ILP-related protocols
- Host: GitHub
- URL: https://github.com/interledger-deprecated/ilp-schemas
- Owner: interledger-deprecated
- License: other
- Created: 2017-12-20T18:03:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-01T22:46:18.000Z (over 8 years ago)
- Last Synced: 2025-10-01T09:54:09.859Z (9 months ago)
- Language: JavaScript
- Size: 451 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ILP Schemas [![npm][npm-image]][npm-url] [![circle][circle-image]][circle-url]
[npm-image]: https://img.shields.io/npm/v/ilp-schemas.svg?style=flat
[npm-url]: https://npmjs.org/package/ilp-schemas
[circle-image]: https://circleci.com/gh/interledgerjs/ilp-schemas.svg?style=shield
[circle-url]: https://circleci.com/gh/interledgerjs/ilp-schemas
> JSON Schemas describing various ILP related protocols and formats.
## Installation
``` sh
npm install --save ilp-schemas
```
## Schema Validator
This module does not contain a schema validator. We recommend using an open-source validator like [ajv](https://github.com/epoberezkin/ajv).
``` js
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)
}
```