This package has been deprecated

Author message:

unmaintained

ajd

0.1.1 • Public • Published

Ajd JavaScript Style Guide Build Status NPM version Coverage Status

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

Readme

Keywords

none

Package Sidebar

Install

npm i ajd

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • isysd