Skip to main content

plan_archive/validate/
mod.rs

1//! Schema validators backing the `plan-archive validate-*` subcommands.
2
3pub mod hosts;
4pub mod local;
5pub mod metadata;
6
7use serde::Serialize;
8
9/// Free-form warning attached to a successful validation envelope.
10///
11/// Validators emit warnings (rather than errors) when the input parses and
12/// matches required fields but has surprising shape — for example, the
13/// pre-classification `metadata.yaml` that omits the captured host
14/// classification field.
15#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
16pub struct ValidationWarning {
17    /// Stable identifier so JSON consumers can branch on the warning.
18    pub code: String,
19    /// Human-readable explanation suitable for `stderr` rendering.
20    pub message: String,
21}
22
23impl ValidationWarning {
24    pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self {
25        Self {
26            code: code.into(),
27            message: message.into(),
28        }
29    }
30}