Skip to main content

Synopsis

dms validate FILE
dms validate --dir DIRECTORY

Description

dms validate checks DMS JSON records against the official schema using the JSON Schema Draft 2020-12 validator. It reports:
  • Errors — schema violations that make the record invalid (missing required fields, wrong types, disallowed enum values, etc.).
  • Warnings — recommended fields that are absent (creator, date, subject, location, rights, source, format). Warnings do not affect the exit code.
Pass a single FILE to validate one record, or use --dir to validate every .json file found in a directory.

Options

FILE
path
Path to a single .json file to validate. Optional when --dir is used.
--dir
path
Directory containing .json files. All files are validated and a batch summary is printed at the end.

Exit codes

CodeMeaning
0All validated records are valid.
1One or more records are invalid, or neither FILE nor --dir was provided.
The non-zero exit code on failure makes dms validate safe to use in CI pipelines. Any invalid record will fail the pipeline step.

Terminal output

Valid record:
╭──────────────────────────────────────────────╮
│ ✓ VALID  records/poem_3f8a1c2b.json           │
╰──────────────────────────────────────────────╯
  ⚠ Recommended field 'Source' is not provided.
Invalid record:
╭──────────────────────────────────────────────╮
│ ✗ INVALID  records/broken.json               │
╰──────────────────────────────────────────────╯
 Field            Issue
 ─────────────────────────────────────────────
 Type             Invalid value 'photograph'. Allowed: story, photo, document, …
 Description      Required field 'Description' is missing.
Batch summary (directory mode):
╭──────────────────────────────╮
│ Batch Validation Summary     │
│                              │
│   Total files:  12           │
│   Valid:        11           │
│   Invalid:      1            │
╰──────────────────────────────╯

Examples

dms validate records/story_abc123.json

Notes

Add dms validate --dir records/ as a pre-commit hook or CI step to catch schema violations before they are merged.
dms validate only checks .json files. Files with other extensions in the directory are silently skipped.