pub struct ValidationRule {
pub logic: Value,
pub message: String,
pub compiled_logic: Option<Arc<Logic>>,
}Expand description
A single validation rule with a condition and error message.
The rule’s logic is evaluated against the message context. If it does not
return exactly true, the validation fails and the error message is recorded.
Fields§
§logic: ValueJSONLogic expression that must evaluate to true for validation to pass.
Any other result (false, null, etc.) is considered a validation failure.
message: StringError message to display if validation fails.
Required when a rule is deserialized as part of a workflow definition —
which is the path Engine::build takes, so a rule without it is
rejected at build time. ValidationConfig::from_json, the standalone
parser, is the one path that substitutes "Validation failed".
compiled_logic: Option<Arc<Logic>>Pre-compiled JSONLogic, populated by LogicCompiler. None is
recorded as a COMPILATION_ERROR at execute time.
Trait Implementations§
Source§impl Clone for ValidationRule
impl Clone for ValidationRule
Source§fn clone(&self) -> ValidationRule
fn clone(&self) -> ValidationRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more