Skip to main content

Module document

Module document 

Source
Expand description

Document layer (spec §4): parse and serialize the three equivalent encodings — .moddef.yaml, .moddef.json, .moddef (proto binary). YAML and JSON follow proto3 JSON (protojson) semantics via the pbjson-generated serde impls; unknown fields and invalid enum values are rejected, matching the Go implementation and the fixtures under moddef/fixtures/invalid. YAML goes through a YAML→JSON value conversion (numeric keys stringified) — the same round-trip the Go loader uses.

Structs§

ParseError
Document-layer failure: unreadable file, malformed input, protojson violations (unknown field, bad enum value), or a bad import uri.

Enums§

DocumentFormat

Functions§

detect_format
Infer the format from a file path per the spec §4 extensions.
load
Load and parse a .moddef.yaml / .moddef.json / .moddef file.
parse_document
Parse a document from bytes in the given format.
save
Serialize and write a document; the format comes from the extension.
serialize_document
Serialize a document. The binary form is deterministic (BTreeMap-backed maps), so it byte-matches Go-produced .moddef files.