pub fn validate(source: &str, contract: &Contract, path: &str) -> Vec<Finding>Expand description
The string-in convenience: parse (frontmatter split + projection), then validate every plane in the TS orchestration order.
Examples found in repository?
examples/validate.rs (line 34)
32fn main() {
33 let contract = load_contract(CONTRACT).expect("the contract compiles");
34 let findings = validate(DOCUMENT, &contract, "decisions/zod.md");
35
36 for f in &findings {
37 let line = f.pos.map_or(0, |p| p.line);
38 println!("{}:{line} {:?} {}: {}", f.path, f.level, f.id, f.message);
39 }
40
41 // `status: done` is not in the enum and the Decision section is missing.
42 let errors = findings
43 .iter()
44 .filter(|f| f.level == FindingLevel::Error)
45 .count();
46 assert_eq!(errors, 2);
47}