Repository navigation
3.0 checks files against a JSON Schema and puts each error at its line and column, in every dialect, comments and JSON5 included. It also writes SARIF for GitHub code scanning, and it ships as a GitHub Action.
Upgrade
Set rev: v3.0.0 in .pre-commit-config.yaml, or uses: simonvanlierde/jsonvet@v3. Most hook users need nothing else. Check the breaking changes below if you run jsonvet from a directory other than its config file's, pass it unknown options from a script, match its paths in a script, or use the Rust library.
What's new
--schema FILE: checks each file against one JSON Schema, offline. Errors come under the ruleschema, at the line and column of the value, with its JSONPath:server.json5:3:9: error[schema] "80" is not of type "integer" (at $.port). It is in every build, the hook and the Action included.--format sarif: one SARIF 2.1.0 document for GitHub code scanning, with the same exit codes as text.- A GitHub Action:
uses: simonvanlierde/jsonvet@v3checks the repository's tracked JSON files, or thefilesyou give it, on Linux, macOS and Windows runners. Withsarif:it also writes a SARIF file for code scanning. - Safer output: file names and messages escape control, bidi and invisible characters, so a file name cannot forge a GitHub annotation or reorder a terminal line.
- A DOI: each release from this one on gets a Zenodo DOI, and
CITATION.cffsays how to cite jsonvet.
Breaking changes
dialectspatterns injsonvet.tomlor[tool.jsonvet]match paths relative to that file, not to the working directory.- An unknown option such as
--xor-xexits 2 instead of 1, unless a file of that name exists. - Non-ASCII keys in paths print as written,
$["日本"]and not$["\u65e5\u672c"]. - Rust library:
Rule::ALLandDialect::ALLare slices,SeverityandLocationare#[non_exhaustive], andUnknownRuleandUnknownDialecthide their text behindid()andname().
The full list, with the fixes, is in the changelog.
Install
uvx jsonvet, pip install jsonvet or cargo install jsonvet-cli. The Rust library is the jsonvet crate.