json-schema-load-tree

0.2.0 • Public • Published

json-schema-load-tree

Loads all references in a json schema, recursively. Currently a work in progress.

Stability:Experimental NPM Version Travis Issues

Commitizen friendly Semantic Release License Maintenance Downloads

Installation:

npm install json-schema-load-tree

Usage:

example.js

import jsonSchemaLoadTree from 'json-schema-load-tree';
 
jsonSchemaLoadTree("http://www.example.com/blog-post.json")
    .then(result => console.log(result));

Output:

{
    "http://www.example.com/blog-post.json": {
        "id": "http://www.example.com/blog-post.json",
        "type": "object",
        "properties": {
            "id": { "type": "number" },
            "author": { "type": "string" },
            "title": { "type": "string" },
            "body": { "type": "string" },
            "metadata": { "$ref": "http://www.example.com/metadata.json" }
        },
        "required": [ "title", "author", "id" ]
    },
    "http://www.example.com/metadata.json": {
        "id": "http://www.example.com/metadata.json",
        "type": "object",
        "properties": {
            "created": { "$ref": "types.json#/definitions/timestamp" }
        }
    },
    "http://www.example.com/types.json": {
        "id": "http://www.example.com/types.json",
        "definitions": {
            "timestamp": {
                "type": "number",
                "description": "UTC Unix timestamp"
            }
        }
    }
}

Package Sidebar

Install

npm i json-schema-load-tree

Weekly Downloads

5

Version

0.2.0

License

MIT

Last publish

Collaborators

  • reactiveraven