schemata-validator
v0.3.1
Published
Check the validity of Schema.org vocabulary used in JSON-LD data
Downloads
309
Maintainers
Readme
schemata-validator
Check the validity of Schema.org vocabulary used in JSON-LD data
schemata-validator takes JSON-LD and HTML files using JSON-LD data and returns detailed validation results.
Installation
Install package for Node.js:
pnpm add --save-dev schemata-validatorYou can also install it using npm:
npm install --save-dev schemata-validatorUsage
Options
data
Type: array
Specifies which JSON-LD data to be sent to validation. This option takes precedence over the other options.
files
Type: array
CLI arguments: -f <space-separated list of files>, --files <space-separated list of files>
Specifies which files to be sent to validation. This option takes precedence over the other options.
paths
Type: array
CLI arguments: -p <space-separated list of paths>, --paths <space-separated list of paths>
Specifies which folders or files to be sent to validation. When omitted, all files are validated (skipping the node_modules folder), unless the exclude option is specified.
exclude
Type: array
CLI arguments: -e <space-separated list of paths>, --exclude <space-separated list of paths>
Lists strings to match in paths to skip. When omitted, all files specified by files options if defined (all files otherwise) are validated (skipping the node_modules folder).
dryRun
Type: boolean
Default: false
CLI arguments: -d, --dry-run
Bypasses the validation (for usage while building CI).
CLI
schemata-validator can be used as a CLI tool.
schemata-validator [flags]package.json scripts
You can run schemata-validator from the scripts section of your package.json file.
{
"scripts": {
"one-folder": "schemata-validator --paths docs",
"one-file": "schemata-validator --files docs/index.html",
"all-files": "schemata-validator"
}
}Examples
schemata-validator: validates all HTML files using JSON-LD data in the project;schemata-validator --paths docs --exclude build tmp: validates all HTML files using JSON-LD data in thedocs/folder, except files which havebuildortmpanywhere in their pathname or filename;schemata-validator --files docs/index.html: validates only the specified files.
Application code
In addition to the CLI interface, schemata-validator can be imported and called in ESM and TypeScript projects.
import { SchemataValidator } from "schemata-validator";
const jsonld = `{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Web page title",
"description": "Web page description"
}`;
const options = { data: [jsonld] };
const validator = new SchemataValidator(options);
const validate = await validator.validate();
validator.log(validate); // Outputs the reporting objectGet help
Copyright & licence
© 2026 Victor Brito — Released under the MIT licence.
