Skip to main content

Module proto

Module proto 

Source
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 .proto document schema.

Structs§

Enum
One enum: a closed set of strings, each with the form it is written in.
EnumValue
One value of an enum.
Field
One field of a message.
FieldOptions
The custom options a field may carry.
Message
One message.
ProtoFile
One parsed .proto document 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 markdown is 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 .proto file read from path, with source naming it in every diagnostic.
read
Read and parse one .proto file.
read_dir
Every .proto under 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.