docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that analyzes JSON Schema documents and identifies all validation-only keywords that should not be traversed when processing schema structures.
{"type": "string", "maxLength": 10}, identifies maxLength as a validation keyword that should not be traversed. @test{"properties": {"name": {"type": "string", "pattern": "^[A-Z]"}}}, identifies pattern as a validation keyword while recognizing properties as a traversable keyword. @testminimum, maximum, exclusiveMinimum, and exclusiveMaximum, correctly categorizes all numeric constraint keywords as non-traversable. @testenum and const keywords, correctly identifies both as validation-only keywords that contain data rather than sub-schemas. @testitems (traversable) and minItems (validation), correctly separates them into different categories. @testrequired array keyword, recognizes it as validation-only despite containing an array value. @test/**
* Returns an object containing all validation keywords that should be skipped during schema traversal.
* These keywords contain validation constraints or metadata, not sub-schemas.
*
* @returns {Object} An object where each key is a skip keyword with value true
*/
function getSkipKeywords() {
// IMPLEMENTATION HERE
}
/**
* Checks if a given keyword is a validation-only keyword that should not be traversed.
*
* @param {string} keyword - The JSON Schema keyword to check
* @returns {boolean} True if the keyword should be skipped during traversal, false otherwise
*/
function isValidationKeyword(keyword) {
// IMPLEMENTATION HERE
}
/**
* Given a schema object, returns an object containing only the validation keywords present.
*
* @param {Object} schema - A JSON Schema object
* @returns {Object} An object containing only the validation keywords from the input schema
*/
function extractValidationKeywords(schema) {
// IMPLEMENTATION HERE
}
module.exports = {
getSkipKeywords,
isValidationKeyword,
extractValidationKeywords
};Provides schema traversal functionality and exposes the standard skipKeywords collection.