docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a tool that analyzes JSON schemas containing custom vendor-specific extensions and reports on their structure.
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.
Your implementation should:
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
/**
* 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 };Provides schema traversal functionality to walk through all schema objects including custom extensions.