Skip to main content

validate

Function validate 

Source
pub fn validate(snapshot: &Snapshot) -> Result<(), Error>
Expand description

Validate that a snapshot is well-formed (SPEC §9): supported version, every node well-formed (see validate_node), and all paths unique within the snapshot.

The rules the Rust types already guarantee are enforced earlier, at deserialization, and are deliberately not re-checked here: string-ness (every field is String), valid Unicode (a Rust String is always UTF-8, and serde_json rejects an unpaired surrogate at parse), content being an object (a non-object fails to deserialize into a map), typed metadata (timestamp: i64, labels: BTreeMap<String, String>, a Ref with both fields), and duplicate object keys (the strict map deserializer in model). SPEC §9 allows refusing at parse or here. This function covers exactly what the types cannot express.