{"id":48306,"library":"json-schema-walker","title":"json-schema-walker","description":"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.","status":"active","version":"3.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/jonluca/json-schema-walker","tags":["javascript","typescript"],"install":[{"cmd":"npm install json-schema-walker","lang":"bash","label":"npm"},{"cmd":"yarn add json-schema-walker","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-schema-walker","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"used for $ref dereferencing in async walking","package":"json-schema-ref-parser","optional":true},{"reason":"used for schema cloning when cloneSchema option is true","package":"lodash.clonedeep","optional":true}],"imports":[{"note":"CommonJS require will not work for named export. Use ESM import.","wrong":"const Walker = require('json-schema-walker')","symbol":"Walker","correct":"import { Walker } from 'json-schema-walker'"},{"note":"TypeScript type-only import for options.","symbol":"WalkerOptions","correct":"import type { WalkerOptions } from 'json-schema-walker'"},{"note":"vocabularies is not directly exported; it's accessed from a Walker instance.","wrong":"import { vocabularies } from 'json-schema-walker'","symbol":"vocabularies","correct":"import { Walker } from 'json-schema-walker';\n// Access via instance: walker.vocabularies.DRAFT_07"}],"quickstart":{"code":"import { Walker } from 'json-schema-walker';\n\nconst schema = {\n  type: 'object',\n  properties: {\n    name: { type: 'string' },\n    age: { type: 'number' }\n  }\n};\n\nconst walker = new Walker();\nawait walker.loadSchema(schema, {\n  cloneSchema: true,\n  dereference: false\n});\n\nconst convertSchema = (s: any): any => {\n  s._visited = true;\n  return s;\n};\n\nawait walker.walk(convertSchema, walker.vocabularies.DRAFT_07);\nconsole.log(walker.rootSchema);\n// Output includes _visited: true on all schema objects.","lang":"typescript","description":"Demonstrates async walk: load a JSON Schema, apply a callback that adds a flag to every schema object, then output the transformed schema."},"warnings":[{"fix":"Use ES module import syntax (import { ... } from ...) instead of require().","message":"Version 3.0.0 dropped CommonJS support. Package is now ESM-only.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Create Walker with no arguments: new Walker().","message":"Walker constructor signature changed in v3: no longer accepts parameters.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Provide a vocabulary, e.g., walker.vocabularies.DRAFT_07.","message":"The 'walk' method now requires a second argument (vocabulary). Omitting it is deprecated.","severity":"deprecated","affected_versions":">=3.0.0 <3.3.0"},{"fix":"Use async loadSchema/walk if your schema contains $ref.","message":"Synchronous methods loadSchemaSync and walkSync do not resolve $ref. They will silently leave $ref unresolved.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Set cloneSchema: true unless you intend to mutate the original.","message":"cloneSchema option defaults to false. If you don't clone, the original schema object is mutated.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'17':72 'async':33 'base':56 'before/after':27 'built':77 'built-in':76 'callback':26 'circular':82 'clone':42 'cloudflar':58 'dereferenc':80 'differenti':74 'document':23 'draft':47 'handl':84 'includ':75 'invok':25 'javascript':90 'json':2,6,21,45,61 'json-schema-tool':60 'json-schema-walk':1,5 'key':73 'librari':13,65 'loos':55 'mit':52 'multipl':44 'node':71 'object':18 'pattern':89 'ref':35,40,79 'refer':83 'releas':50 'requir':70 'resolut':36 'schema':3,7,17,22,46,62 'ship':66 'simpl':87 'subschema':29 'support':31 'sync':38 'tool':63 'travers':15,41 'type':68 'typescript':12,67,91 'v3.3.0':9 'via':48 'visit':28 'vocabulari':49 'walker':4,8,88 'without':39","created_at":"2026-06-07T16:55:57.897216+00:00","updated_at":"2026-06-07T16:55:57.897216+00:00","problems":[{"fix":"Use import() or dynamic import. Alternatively, add \"type\": \"module\" to your package.json.","cause":"The package is ESM-only since v3.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported."},{"fix":"Ensure you created a Walker instance: const w = new Walker(); await w.walk(...);","cause":"You are using the synchronous method incorrectly or imported the wrong symbol.","error":"TypeError: walker.walk is not a function"},{"fix":"Use walker.vocabularies (e.g., walker.vocabularies.DRAFT_07).","cause":"vocabularies is not directly exported; it's an instance property.","error":"ReferenceError: vocabularies is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jonluca/json-schema-walker","github":"https://github.com/jonluca/json-schema-walker","docs":null,"changelog":null,"pypi":null,"npm":"json-schema-walker","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}