or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-4/

Custom JSON Schema Extension Analyzer

Build a tool that analyzes JSON schemas containing custom vendor-specific extensions and reports on their structure.

Problem Description

You need to create a schema analyzer that processes JSON schemas containing non-standard custom keywords (such as vendor extensions like x-custom, myExtension, etc.). The analyzer should traverse the entire schema structure, including these custom extensions, and collect information about them.

Requirements

Your implementation should:

  1. Accept a JSON schema object that may contain custom vendor-specific keywords
  2. Traverse the entire schema structure, including non-standard keywords
  3. Collect all custom extension keywords found (any object-valued properties that aren't standard JSON Schema keywords)
  4. Return a summary report containing:
    • Total count of custom extensions found
    • List of unique custom keyword names used
    • Details array with path and keyword name for each occurrence

Test Cases

  • Given a schema with a single custom extension x-custom at root level containing {minimum: 1}, the analyzer returns a report showing 1 custom extension found with the correct path and keyword name @test

  • Given a schema with nested custom extensions (e.g., x-vendor inside properties and x-custom at root), the analyzer finds both extensions and reports their correct paths @test

  • Given a schema with only standard JSON Schema keywords (properties, type, items, etc.) and no custom extensions, the analyzer returns a report with 0 custom extensions found @test

Implementation

@generates

API

/**
 * Analyzes a JSON schema and reports on custom extensions found.
 *
 * @param {object} schema - The JSON schema to analyze
 * @returns {object} Analysis report with structure:
 *   {
 *     totalCustomExtensions: number,
 *     uniqueKeywords: string[],
 *     details: Array<{path: string, keyword: string}>
 *   }
 */
function analyzeSchema(schema) {
  // IMPLEMENTATION HERE
}

module.exports = { analyzeSchema };

Dependencies { .dependencies }

json-schema-traverse { .dependency }

Provides schema traversal functionality to walk through all schema objects including custom extensions.

@satisfied-by