json-schema-ref-parser Issue #74

node v8.17.0
version: 1.0.0
endpointsharetweet
const parser = require("json-schema-ref-parser"); const fs = require('fs'); fs.writeFileSync('definitions.schema.json', ` { "$schema": "http://json-schema.org/draft-06/schema#", "$id": "http://127.0.0.1:8181/base/definitions.schema.json#", "name": "definitions", "type": "object", "definitions": { "auto_increment": { "type": "number", "minimum": 1 } } } `); fs.writeFileSync('foo.schema.json', ` { "$schema": "http://json-schema.org/draft-06/schema#", "$id": "http://127.0.0.1:8181/foo.schema.json", "name": "foo", "type": "object", "properties": { "foo": { "$ref": "definitions.schema.json#/definitions/auto_increment" }, "bar": { "$ref": "definitions.schema.json#/definitions/auto_increment" } }, "required": [ "foo", "bar" ] } `); fs.writeFileSync('schema.json', ` { "$schema": "http://json-schema.org/draft-06/schema#", "type": "object", "allOf": [ { "properties": { "body": { "$ref": "foo.schema.json" } } } ] } `); parser.bundle('schema.json').then(bundle => console.log(JSON.stringify(bundle, null, 2)));
Created from: https://npm.runkit.com/json-schema-ref-parser
Loading…

no comments

    sign in to comment