Skip to main content

a3s_flow/
validation.rs

1//! Pre-flight flow validation.
2//!
3//! [`ValidationIssue`] is the unit of output from [`FlowEngine::validate`].
4//! Each issue describes one structural problem found in a flow definition.
5//!
6//! [`FlowEngine::validate`]: crate::engine::FlowEngine::validate
7
8/// A structural problem found in a flow definition by [`FlowEngine::validate`].
9///
10/// [`FlowEngine::validate`]: crate::engine::FlowEngine::validate
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct ValidationIssue {
13    /// The node ID where the issue was found, or `None` for flow-level issues.
14    pub node_id: Option<String>,
15    /// Human-readable description of the problem.
16    pub message: String,
17}
18
19impl std::fmt::Display for ValidationIssue {
20    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21        match &self.node_id {
22            Some(id) => write!(f, "node '{}': {}", id, self.message),
23            None => write!(f, "{}", self.message),
24        }
25    }
26}