json-schema-walker v3.3.0 is a TypeScript library that traverses all schema objects in a JSON Schema document and invokes callbacks before/after visiting subschemas. It supports both async (with $ref resolution) and sync (without $ref) traversal, cloning, and multiple JSON Schema drafts (via vocabularies). Released under MIT, it is loosely based on CloudFlare's json-schema-tools. The library ships TypeScript types and requires Node >=17. Key differentiators include built-in $ref dereferencing with circular reference handling and a simple walker pattern.
npm install json-schema-walkerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates async walk: load a JSON Schema, apply a callback that adds a flag to every schema object, then output the transformed schema.
Use ES module import syntax (import { ... } from ...) instead of require().Create Walker with no arguments: new Walker().
Provide a vocabulary, e.g., walker.vocabularies.DRAFT_07.
Use async loadSchema/walk if your schema contains $ref.
Set cloneSchema: true unless you intend to mutate the original.
Use import() or dynamic import. Alternatively, add "type": "module" to your package.json.
Ensure you created a Walker instance: const w = new Walker(); await w.walk(...);
Use walker.vocabularies (e.g., walker.vocabularies.DRAFT_07).