Skip to content
Edith

Docs

Command reference

ed schema-check validate

The ed command line

Validate one or more JSON documents against a JSON Schema without network access.

Terminal
ed schema-check validate /tmp/order.schema.json /tmp/order.jsoned schema-check validate /tmp/order.schema.json /tmp/a.json /tmp/b.json --formats --json

Every argument must name a regular local file of at most 8 MiB. Relative paths resolve against the current directory. Up to 100 documents are validated per run, in the order given. Draft-07, 2019-09 and 2020-12 schemas are supported. A schema without $schema is read as 2020-12.

References resolve inside the schema, to embedded $id resources and to .json files in the schema's folder or its subfolders. When the root schema has an https $id, references under that base map to files beside the schema. Remote URLs, files outside the folder, other file types, more than 63 referenced files and more than 16 MiB of schema files in total are refused. Unknown or unsupported dialects, unresolved references, cyclic references that never descend into the document and malformed keywords are reported as schema problems, and no document is validated.

format is an annotation by default. --formats reports invalid date-time, date, time, duration, email, hostname, ipv4, ipv6, uri, uri-reference, uuid, json-pointer, relative-json-pointer and regex values. Other format names are ignored.

pattern and patternProperties follow ECMA-262 for $, which matches only at the end of the value, and for \d, \D, \w and \W outside character classes, which match ASCII only. A pattern that takes longer than one second on one value stops that document with a limitReached issue.

The default output is a Markdown report. --json returns schema, dialect, dialectDeclared, checkFormats, references, passed, truncated, summary, schemaIssues and documents. Schema issues carry kind, message and location. Each document carries file, valid, issue, truncated and violations. A violation carries instancePath (JSON Pointer), propertyPath (for example items[1].quantity), keyword, schemaPath (the evaluation path through references), schemaLocation (the file and pointer to edit), message and, for anyOf and oneOf, the first causes from each option.

The command exits 0 when every document is valid and 1 when the schema or any document fails. Reports list at most 200 problems per document, 1,500 problems with their causes across all documents and 200 schema problems, shorten long paths and messages, and set truncated when anything is left out. A document whose problems were left out is still reported as invalid. Reports contain no timestamps. File paths are included, so review reports before sharing them.