1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! RM/BASE class-invariant contract (hand-written spec behaviour).
//!
//! Hand-written; preserved across `openehr-codegen` regeneration (it is not a
//! `// @generated` file, so `write_crate` keeps it and `lib.rs` auto-declares
//! `pub mod validate;`). Concrete invariant bodies live in sibling `*_impl.rs`
//! files next to each generated type and `impl Validate for <Type>`.
//!
//! The invariant SET is the specification's own: every check corresponds to a
//! named invariant in an RM/BASE class page's §Invariants section
//! (`docs/specs/openehr/{RM,BASE}/docs/UML/classes/`), and each impl cites the
//! page and invariant name it enforces. What the specifications leave
//! underdetermined is the *algorithm* — openEHR's AOM2 `validation` spec covers
//! ARCHETYPE validation, not RM-instance validation — so the traversal,
//! violation shape and sub-path reporting below are our own design; the
//! `// NOTE:` markers in the impls flag each such choice.
/// An RM class-invariant violation: a human-readable message plus the RM
/// sub-path (relative to the value being checked) it applies to.
///
/// An empty path means the value itself; the composition validator prefixes
/// the absolute RM path.
/// The RM class invariants of a spec type. Implemented in `*_impl.rs` siblings.