<!-- BADGES -->
npm install @stoplight/json-schema-tree- json-schema-viewer
- json-schema-editor
- masking
Supported in modern browsers and Node.JS (>=10.18).
``bash`latest stable
yarn add @stoplight/json-schema-tree
`js
import { SchemaTree, SchemaNodeKind, isRegularNode } from '@stoplight/json-schema-tree';
const tree = new SchemaTree(mySchema);
const ALLOWED_DEPTH = 2;
tree.walker.hookInto('stepIn', node => tree.walker.depth <= ALLOWED_DEPTH); // if flattening is needed, this might need to be tweaked to account for the scenarios where certain nodes can be merged (i.e. arrays)
tree.walker.hookInto('filter', node => {
return !isRegularNode(node) || node.types === null || !node.types.includes(SchemaNodeKind.Integer); // if a schema property is of type integer, it won't be included in the tree
});
tree.populate();
tree.root; // populated tree
`
1. Clone repo.
2. Create / checkout feature/{name}, chore/{name}, or fix/{name} branch.yarn
3. Install deps: .yarn test.prod
4. Make your changes.
5. Run tests: .yarn commit
6. Stage relevant files to git.
7. Commit: . _NOTE: Commits that don't follow theyarn commit
conventional format will be
rejected. creates this format for you, or you can put it together manually and then do a regulargit commit
._git push
8. Push: .master` branch.
9. Open PR targeting the