pub fn guards_without_terms<'a>(
consequences: &'a [Consequence],
terms: &[Term],
) -> Vec<&'a str>Expand description
Guards that name a value the vocabulary doesn’t have — a lint, run when an embedder loads its schema, not part of validation.
A guard is silent when it is wrong: Consequence::when("none", …) against a
vocabulary spelling it off simply never fires, and the user commits the
expensive change with no warning at all. Nothing else in the crate can
notice, because a guard that matches nothing is indistinguishable from a
guard for a value the user hasn’t chosen yet.
Only Some(Value::Str(_)) guards are checked: an unguarded consequence has
no value to look up, and a bool or numeric guard is not a vocabulary term.
A retired term counts as present — it is still a known
value, and warning about one is exactly what a retirement wants.
use fig_schema::{Consequence, Term, guards_without_terms};
let terms = [Term::value("off"), Term::value("registry")];
let declared = [
Consequence::when("none", "History will be discarded."),
Consequence::when("off", "History will be discarded."),
];
assert_eq!(guards_without_terms(&declared, &terms), vec!["none"]);