Skip to main content

purrdf_validate/
lib.rs

1// SPDX-FileCopyrightText: 2026 Blackcat Informatics® Inc. <paudley@blackcatinformatics.ca>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! `purrdf-validate` — the **SARIF 2.1.0 reporting boundary** for PurRDF.
5//!
6//! PurRDF keeps its kernel (`purrdf-core`) *structured but SARIF-free*: parse
7//! failures are [`RdfDiagnostic`]s, SHACL results are [`ValidationReport`]s, and
8//! neither knows anything about SARIF or serde. This crate is where that
9//! structured data crosses the boundary into a **source-traced, byte-deterministic
10//! SARIF 2.1.0 log** for editors, CI, and code-scanning dashboards.
11//!
12//! # What lives here (and why here)
13//!
14//! * The hand-rolled SARIF serde model (no heavyweight SARIF dependency).
15//! * The mappings from PurRDF severities/rules/locations to SARIF
16//!   `level`/`ruleId`/`physicalLocation`/`logicalLocation`.
17//! * The resolution of runtime-only provenance ids (`UnitId`) to public slice
18//!   IRIs — this is the serialization boundary where S0.5 permits it; the numeric
19//!   ids never enter the emitted JSON.
20//!
21//! Hosting the writer in this leaf keeps the kernel ring-fence intact: `purrdf-core`
22//! and `purrdf-shapes` never gain a SARIF or serde-derive concern.
23//!
24//! # Portability
25//!
26//! Pure serde over the report types — no PyO3, no oxigraph-family edge, no ambient
27//! I/O — so the crate stays `wasm32-unknown-unknown`-clean like every release crate.
28//!
29//! [`RdfDiagnostic`]: purrdf_core::RdfDiagnostic
30//! [`ValidationReport`]: purrdf_shapes::report::ValidationReport
31#![doc(
32    html_logo_url = "https://raw.githubusercontent.com/Blackcat-Informatics/purrdf/main/docs/purrdf-logo.svg"
33)]
34#![doc(
35    html_favicon_url = "https://raw.githubusercontent.com/Blackcat-Informatics/purrdf/main/docs/purrdf-logo.svg"
36)]
37#![forbid(unsafe_code)]
38
39pub mod build;
40pub mod entail;
41pub mod model;
42pub mod path_syntax;
43pub mod rules;
44pub mod shacl;
45
46pub use build::{
47    SarifOptions, SarifReport, SarifSources, build_diagnostics_sarif, build_report_sarif,
48    build_report_sarif_with, diagnostics_to_sarif_string, report_to_sarif_string,
49};
50pub use entail::entail_to_ntriples_string;
51pub use model::{Level, SARIF_SCHEMA, SARIF_VERSION, SarifLog, to_json_pretty};
52pub use shacl::validate_to_sarif_string;