Skip to main content

Module documents

Module documents 

Source
Expand description

Documents on disk, as JSON or TOML, in every app (standard §2.2, decision 0017): pipelines, recipes, op descriptions, settings. TOML is easier to write by hand (dsp-kitchen’s pipelines were the first to take it); JSON is what tools write. Either reads into the same document, and a document’s content id is the hash of its canonical JSON (content_id), so the format a person chose never changes an id.

Enums§

DocFormat
How a document is written.

Functions§

content_id
A document’s content id: the hash of its canonical JSON, the same for its JSON and TOML forms.
parse
text in format as a T (a Pipeline, an OpSpec, …).
read
The document at path (.json or .toml).
render
value as text in format: pretty JSON, or TOML (which has no null: absent fields are left out, as the contract’s types already do).
to_value
text in format as a JSON value (what a document is, whatever it was written in).
write
Writes value to path in the format its extension names.