Skip to main content

Module project

Module project 

Source
Expand description

The projections of a .proto document schema.

The .proto is canonical and nothing else is written by hand. Two artifacts come out of it here:

the JSON Schema beside it, which the Rust indexer validates front matter against and from which share/allow/<name>.txt is derived, so the shell tool and the executable read one contract rather than two;

the section list share/sections/<name>.txt, which is the body half of the contract in the plainest form a shell can read.

Both are tracked, because bin/majordomus doctor is pure shell and must validate a fresh checkout without a Rust build having ever run. scripts/derive-check regenerates them and fails on a difference, which is what keeps “canonical” true.

Constants§

DERIVED_EXTENSION
The extension naming the .proto a JSON Schema was derived from. A schema that carries it is not to be edited; the file it names is.
SCHEMA_EXTENSION
The extension carrying the schema identity on a derived JSON Schema.
SECTIONS_EXTENSION
The extension carrying the body contract, for a reader of the JSON Schema alone.

Functions§

schema_path
The file name a schema identity derives for its JSON Schema projection, relative to the schema root: majordomus.adr/v1 is majordomus/adr/adr.v1.schema.json.
section_lines
The section list the shell tool reads: one section per line, tab-separated, in document order — level, heading, required/optional, non-empty/any. A kind with no body contract projects an empty file, which is an answer rather than a missing artifact.
to_json_schema
The whole document as one JSON Schema: header against the Header message, and for a Markdown kind body against the sections the Body message names.