Skip to main content

zenith_core/validate/check/
report.rs

1//! The validation outcome type.
2//!
3//! [`ValidationReport`] is the public result of a full document validation
4//! pass; it is re-exported from the check module root as part of the crate's
5//! public validate API.
6
7use crate::diagnostics::{Diagnostic, Severity};
8
9/// The outcome of a full document validation pass.
10#[derive(Debug, Clone, PartialEq)]
11pub struct ValidationReport {
12    /// All diagnostics collected during validation (token resolution +
13    /// document-level checks). Never causes a hard panic; always complete.
14    pub diagnostics: Vec<Diagnostic>,
15}
16
17impl ValidationReport {
18    /// Returns `true` if any diagnostic has [`Severity::Error`].
19    pub fn has_errors(&self) -> bool {
20        self.diagnostics
21            .iter()
22            .any(|d| d.severity == Severity::Error)
23    }
24}