Traverse JSON Schema passing each schema object to callback
94
Build a tool that analyzes JSON Schema documents and generates a detailed report about schema structure using path information.
Your tool should traverse a JSON Schema and collect information about each schema object, then generate a structured report showing:
The tool should export a function analyzeSchema(schema) that:
paths: An array of objects with path, type, parent, parentKeyword, and depth propertiesmaxDepth: The maximum nesting depth found in the schematotalSchemas: The total count of schema objects found@generates
/**
* Analyzes a JSON Schema document and returns structural information
* @param {Object} schema - The JSON Schema to analyze
* @returns {Object} Analysis results with paths, maxDepth, and totalSchemas
*/
function analyzeSchema(schema) {
// Implementation here
}
module.exports = { analyzeSchema };Provides JSON Schema traversal functionality with rich contextual information about each schema object's location and relationships.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-json-schema-traversedocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10