Skip to content

Findings as JSON or SARIF

validate-03 · CLI transcript

The same run renders for machines: --format json emits the raw findings array, --format sarif feeds code-scanning uploads.

Builds on: Read a finding, fix the doc

A terminal session: the command as you’d run it, followed by the output it prints; trailing comments note the exit status.

Terminal window
# the raw Finding[] for your own tooling
markdown-contract validate ./decisions --format json
[
{
"id": "structure/section-missing",
"level": "error",
"path": "D-0007.md",
"message": "required section ‘Decision’ is missing",
"pos": {
"line": 12,
"col": 1
}
}
]
# SARIF 2.1.0 for code scanning
markdown-contract validate ./decisions --format sarif > results.sarif
# exit status: 1 either way — the format changes the report, never the verdict
  • --format json (raw Finding[])
  • --format sarif (SARIF 2.1.0)
  • format-independent exit codes