Validate file system structure and optionally file contents using an extended JSON Schema. Current stable version: 1.0.17. Release cadence: irregular. Key differentiators: extends JSON Schema with a custom 'contents' keyword to validate file content against regex patterns; includes a shorthand notation to quickly generate schemas from file lists; supports CLI commands (validate, shorthand, parse) and programmatic API. Different from similar tools (e.g., ajv-cli) by focusing on directory structure validation rather than general JSON instance validation.
npm install directory-schema-validatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates schema creation with shorthand, manual schema with 'contents' keyword, parsing a directory, and parsing directory structure using Validator.
Use dynamic import() or switch to an ESM-compatible project configuration (type: module in package.json).
Ensure you use the Validator class from this library and not a generic AJV instance.
Be aware that symlinks are not included in the parsed tree, which may cause validation to miss expected files.
Use glob patterns in CLI and exact relative paths in programmatic calls.
Run 'npm install directory-schema-validator' and use correct import syntax: 'directory-schema-validator'.
Use ES module imports: 'import { Validator } from 'directory-schema-validator''.Set 'type': 'module' in your package.json or use .mjs file extension.
Use the Validator class from this library which registers the custom keyword.