Traverse JSON Schema objects, calling a callback for each schema node (including the root) in a depth-first pre-order or with separate pre/post callbacks. v1.0.0 is stable and widely used, with no known breaking changes since v0. Present in many JSON Schema validation pipelines (e.g., Ajv). Differentiates from generic object traversal by resolving JSON Pointers and parent schema context. Ships TypeScript declarations. Low release cadence.
npm install json-schema-traverseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic traversal with callback, pointer collection, and the allKeys option.
Use a JSON Schema resolver like json-schema-ref-parser before traversal if you need resolved schemas.
To include boolean schemas, set 'allKeys: true'.
Use traverse(schema, { cb: myCallback }) instead of traverse(schema, myCallback).Migrate from traverse(schema, pre, post) to traverse(schema, { pre, post }).Use `const traverse = require('json-schema-traverse').default` or enable esModuleInterop in TypeScript.Use a $ref resolver beforehand, or handle $ref manually in the callback.
Ensure cb is a function or { pre: Function, post: Function }.No dependency data recorded yet.