or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-8/

JSON Schema Keyword Filter

A utility that analyzes JSON Schema documents and identifies all validation-only keywords that should not be traversed when processing schema structures.

Capabilities

Identifies Standard Validation Keywords

  • Given a JSON Schema with {"type": "string", "maxLength": 10}, identifies maxLength as a validation keyword that should not be traversed. @test
  • Given a JSON Schema with {"properties": {"name": {"type": "string", "pattern": "^[A-Z]"}}}, identifies pattern as a validation keyword while recognizing properties as a traversable keyword. @test

Filters Out Constraint Keywords

  • Given a JSON Schema containing minimum, maximum, exclusiveMinimum, and exclusiveMaximum, correctly categorizes all numeric constraint keywords as non-traversable. @test
  • Given a JSON Schema with enum and const keywords, correctly identifies both as validation-only keywords that contain data rather than sub-schemas. @test

Distinguishes Traversable from Non-Traversable Keywords

  • Given a schema with both items (traversable) and minItems (validation), correctly separates them into different categories. @test
  • Given a schema with required array keyword, recognizes it as validation-only despite containing an array value. @test

Implementation

@generates

API

/**
 * 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
};

Dependencies { .dependencies }

json-schema-traverse { .dependency }

Provides schema traversal functionality and exposes the standard skipKeywords collection.

@satisfied-by