You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

json-schema-walker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-walker

A system that visits all schema objects in a JSON Schema document and makes callbacks before visiting all of the current schema object's subschemas.

3.0.1
latest
Source
npmnpm
Version published
Weekly downloads
209K
-0.65%
Maintainers
1
Weekly downloads
 
Created

What is json-schema-walker?

The json-schema-walker package is a utility for traversing JSON schemas. It allows developers to walk through JSON schema objects and perform operations on each node, which is useful for tasks such as validation, transformation, or analysis of JSON schemas.

What are json-schema-walker's main functionalities?

Schema Traversal

This feature allows you to traverse a JSON schema and perform operations on each node. In the code sample, the walker function is used to iterate over each node in the schema, printing the pointer (path) to each node.

const walker = require('json-schema-walker');

const schema = {
  type: 'object',
  properties: {
    name: { type: 'string' },
    age: { type: 'integer' }
  }
};

walker(schema, {
  all: (subSchema, pointer) => {
    console.log('Visiting:', pointer);
  }
});

Custom Node Processing

This feature allows you to apply custom logic to nodes based on their properties. In the code sample, the walker function is used to identify nodes of type 'string' and print their path.

const walker = require('json-schema-walker');

const schema = {
  type: 'object',
  properties: {
    name: { type: 'string' },
    age: { type: 'integer' }
  }
};

walker(schema, {
  all: (subSchema, pointer) => {
    if (subSchema.type === 'string') {
      console.log('String type found at:', pointer);
    }
  }
});

Other packages similar to json-schema-walker

FAQs

Package last updated on 03 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts