Package Exports
- schema-deref
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (schema-deref) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
schema-deref
returns json-schema with any $ref's de-referenced
install
with npm, do:
npm i --save schema-derefexample
var schemaDeRef = require('schema-deref');
var resourceSchema = {
id: "http://example.org/Resource#",
properties: {
name: {
type: "string",
},
},
};
var personSchema = {
id: "http://example.org/Person#",
properties: {
name: {
type: "string",
},
resources: {
type: 'array',
items: {
$ref: "http://example.org/Resource#",
},
},
},
};
var schemas = {};
schemas[resourceSchema.id] = resourceSchema;
schemas[personSchema.id] = personSchema;
var derefd = schemaDeRef(schemas, personSchema);
console.log(JSON.stringify(derefd, null, 2));
//{
// "id": "http://example.org/Person#",
// "properties": {
// "name": {
// "type": "string"
// },
// "resources": {
// "type": "array",
// "items": {
// "id": "http://example.org/Resource#",
// "properties": {
// "name": {
// "type": "string"
// }
// }
// }
// }
// }
//}license
AGPLv3