Skip to main content

jellyflow_core/core/validate/
report.rs

1use super::GraphValidationError;
2
3#[derive(Debug, Default)]
4pub struct GraphValidationReport {
5    pub errors: Vec<GraphValidationError>,
6}
7
8impl GraphValidationReport {
9    pub fn is_ok(&self) -> bool {
10        self.errors.is_empty()
11    }
12
13    pub fn errors(&self) -> &[GraphValidationError] {
14        &self.errors
15    }
16
17    pub fn into_errors(self) -> Vec<GraphValidationError> {
18        self.errors
19    }
20
21    pub(crate) fn push(&mut self, error: GraphValidationError) {
22        self.errors.push(error);
23    }
24
25    pub(crate) fn has_unsupported_graph_version(&self) -> bool {
26        self.errors
27            .iter()
28            .any(|error| matches!(error, GraphValidationError::UnsupportedGraphVersion { .. }))
29    }
30}