Skip to main content

Module canonical

Module canonical 

Source
Expand description

Deterministic re-packing of a validated archive.

LF line endings, canonical-form markdown (via entity::generator::generate_markdown), custom canonical JSON for the config (sorted keys, two-space indent), and a zip with sorted entries, fixed mtime (1980-01-01), DEFLATE level 6. Pinned by golden-file tests so any serialization change breaks CI.

Functions§

canonical_bytes
Take the validated entities + config and produce a deterministic zip. Markdown is regenerated via generate_markdown (already schema-ordered and parse-stable); config is serialized via the custom canonical JSON formatter in this module; embedded schema files are written back verbatim (they were CRLF-normalized at archive-extract time). Every entry is emitted in sorted path order with fixed mtime so two semantically equal archives produce identical bytes.
canonical_json
Serialize a PublishedMemConfig as canonical JSON: sorted keys, two-space indent, LF line endings, trailing \n. Uses serde_json’s default string-escape rules (so behavior matches the parser’s tolerance).