README
Ajd
Another JSON dereferencer, based on ajv.
A fast and simple JSON dereferencer for JSON schema draft 06. Leaves circular references in place for speed and accuracy. Uses ajv for caching.
- http(s):// references
- file:// references
- local pointers (#*)
Returns a Promise.
Install
Install ajd
:
$ npm i --save ajd
Usage
Create a new folder for your project:
HTTP ref
ajd({'$ref': 'https://iramiller.com/schema.json'}).then(function (schema, err) {
console.log(schema) // dereffed schema contents
})
Circular ref
ajd({
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "circle.circle#",
"title": "A circular schema",
"properties": {
"additionalItems": {
"$ref": "#"
}
}
}).then(function (schema, err) {
console.log(require('circular-json').stringify(schema))
})
Will output:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "circle.circle#",
"title": "A circular schema",
"properties": {
"additionalItems": "~"
}
}
Cached ajv
ajd({'$ref': '#/ajv/already/has/schema'}, ajv).then(function (schema, err) {
console.log(schema) // dereffed schema contents
})