feat(validation): ✨ abort validation when the file descriptor is not valid JSON#181
Merged
kikkomep merged 3 commits intoJun 24, 2026
Merged
Conversation
Add an abort mechanism to the validation framework so a check can stop the whole run when the metadata is unreadable (e.g. the file descriptor is not valid JSON), instead of letting later checks emit false positives.
…lidation Make the "File Descriptor JSON format" check (RO-Crate 1.1 and 1.2) catch JSONDecodeError explicitly: report a precise issue with the parse error message and line/column, then call context.abort_validation() so no metadata is read and downstream checks don't emit false positives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the RO-Crate file descriptor (
ro-crate-metadata.json) is not valid JSON, the metadata cannot be read, so every check that depends on it used to fail and flood the report with false positives.This PR introduces an unconditional abort mechanism in the validation framework and uses it to fail fast on unparsable metadata: the "File Descriptor JSON format" check now reports a precise issue (parse error message and line/column) and aborts the run, so the only reported failure is the JSON-format one.
What changes
ValidationContext: addaborted/abort_reasonstate and anabort_validation()methodJSONDecodeError, reports an ad-hoc issue with the error position, and aborts