Skip to content
jsonvet

21. A catalog schema that cannot be used is a note, and the file is checked without a schema

Status: accepted (2026-11-30)

Supersedes in part 0016: a matched schema that cannot be used no longer stops the run.

Context

Under 0016, a matched catalog schema that could not be used was a usage error (exit 2). The package.json schema on SchemaStore references prettierrc.json through an external $ref, which jsonvet does not follow. So one package.json in a --schema-catalog run stopped the checking of every other file, for a schema the user does not control.

Options

  • Keep exit 2. The user sees the problem at once, but a change on SchemaStore can fail every run that names such a file. The only way around it is --schema for each such file.
  • A schema error at the file (exit 1), as for a local $schema file that cannot be used. The run carries on, but it still fails on a schema the user cannot fix in the file.
  • A note, and the file is checked without a schema. The run carries on, and the exit code depends only on the files’ own problems.

Argued, not measured.

Decision

The third option. A matched catalog schema that cannot be used gets one note for each schema URL, which names the first file it matched and the reason. Reasons include an origin other than the three SchemaStore ones, an external $ref, or a failed download with no usable cached copy. That file is checked without a schema, and the note leaves the exit code alone.

Two cases still stop the run with exit 2. A catalog index that cannot be loaded matches no file at all. A catalog schema that takes the run past its 1,000 patterns stops it as any other schema does (0010). A fresh cached schema that cannot be used is reported with its reason and not downloaded again, as a download would bring the same body.

Consequences

A --schema-catalog run can pass while a file was not checked against its schema. Only the note says so: on stderr in text output, and in notes in JSON output. A CI job that reads only the exit code does not see it.

Confirmation

The tests in crates/jsonvet-cli/tests/catalog.rs: an_unusable_catalog_schema_does_not_stop_the_other_files, matched_unsupported_origin_is_a_note_and_the_file_is_checked_without_a_schema, a_catalog_that_cannot_be_loaded_stops_the_run and catalog_schemas_past_the_run_pattern_limit_stop_the_run_without_a_note.

Revisit if

Users ask for a file left without its catalog schema to fail the run, or jsonvet starts to follow external $refs.