Expand description
The reader for the layer’s Markdown document schemas.
A Markdown kind of this layer is described by one .proto file: Header is the YAML
front matter, Body names the sections the Markdown body must carry, and Document is
the pair. The dialect is proto3 plus the option vocabulary in
share/schemas/majordomus/options.proto — what proto3 has no native word for
(presence, a constant, a pattern) is a custom option there.
Nothing parses a .proto at run time. This module is used only by
crate::generate, which projects each file into the artifacts the validators
actually read: the shell tool’s allow-list and section list, and a JSON Schema for the
Rust indexer. That keeps the hot path free of a second parser (hot-path-reads-once)
and keeps one definition of each contract (ADR 0004): the .proto is canonical and
every other form is derived from it.
The parser is deliberately small: it reads the dialect these schemas are written in and refuses everything else by name, rather than silently accepting proto it does not model.
Modules§
- project
- The projections of a
.protodocument schema.
Structs§
- Enum
- One
enum: a closed set of strings, each with the form it is written in. - Enum
Value - One value of an enum.
- Field
- One field of a message.
- Field
Options - The custom options a field may carry.
- Message
- One
message. - Proto
File - One parsed
.protodocument schema.
Constants§
- MSG_
BODY - The message naming the sections of the Markdown body.
- MSG_
DOCUMENT - The message naming the whole document: the header and the body.
- MSG_
HEADER - The message describing the YAML front matter.
- OPT_
ALLOW_ LIST - The allow-list this schema projects for the shell tool.
- OPT_
BODY - The message names body sections rather than a data shape.
- OPT_
CLOSED - No key beyond the fields declared.
- OPT_
CONST - The value must equal this string exactly.
- OPT_
DOCUMENT_ FORMAT - How a file of this kind is read; only
markdownis described in proto. - OPT_
HEADING - The heading text of a body section.
- OPT_KEY
- The key as written in the document, when the proto field name cannot spell it.
- OPT_
LEVEL - The heading level of a body section.
- OPT_
MAXIMUM - Inclusive upper bound of an integer.
- OPT_
MINIMUM - Inclusive lower bound of an integer.
- OPT_
MIN_ ITEMS - Least number of items of a repeated field.
- OPT_
MIN_ LENGTH - Least length of a string.
- OPT_
NON_ EMPTY - The section must carry content, not only exist.
- OPT_
PATTERN - The value must match this anchored expression.
- OPT_
REQUIRED - The key must be present.
- OPT_
SCHEMA_ ID - The identity a schema declares, which fixes its own path.
- OPT_
VALUE - The enum-value option carrying the string the value is written as.
- PROTO_
SUFFIX - The suffix of a document schema written in proto.
Functions§
- parse
- Parse one
.protofile read frompath, withsourcenaming it in every diagnostic. - read
- Read and parse one
.protofile. - read_
dir - Every
.protounder a schema root, keyed by the identity each declares, parsed. A root that does not exist yields nothing. A file whose declared identity disagrees with its path is an error naming both.