@mojule/schema-tree

1.0.0 • Public • Published

schema-tree

Use tree API over JSON Schema

Install

npm install @mojule/schema-tree

Example

const SchemaTree = require( '@mojule/schema-tree' )
const jsonSchema = require( './test.schema.json' )

const tree = SchemaTree.fromSchema( jsonSchema )

const integerNodes = tree.subNodes.filter( n =>
  n.nodeType === SchemaTree.INTEGER_NODE
)

integerNodes.forEach( n => n.value.minimum = 1 )

const newSchema = tree.toSchema()

console.log( JSON.stringify( newSchema, null, 2 ) )

Readme

Keywords

Package Sidebar

Install

npm i @mojule/schema-tree

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nrkn
  • andybell