from babregen.spec import FIELDS
status = next(f for f in FIELDS["decision"] if f.key == "status")
print(status.kind, status.choices, status.default)text ('active', 'superseded', 'expired') active
One field of a record kind: the unit of the schema of regen/.
FIELDS lists the fields of the three record kinds. The loaders, the error messages and the documentation all read this one description; no other list of keys, types, required keys or vocabularies exists.
| Name | Type | Description |
|---|---|---|
| key | str | The TOML key. |
| kind | str | What the value is. text is a string, texts an array of strings, pairs an array of two-string arrays (loaded sorted), date a TOML date or an ISO date string, table a table whose keys are the items, tables an array of tables whose fields are the items, and map a table with free keys whose values are arrays of strings. |
| required | bool | Whether the key must be present. A required text must also be non-empty unless empty is set; a required map must hold a key. |
| prose | bool | Whether a text (or each text of texts) is a prose field: it is folded into one line, so it is for sentences and not for code or anything that needs its line breaks. |
| choices | tuple[str, …] | The vocabulary of a text; empty when any string is allowed. |
| default | str | None | The value of an absent text that has a vocabulary. |
| empty | bool | Whether the generic check of a required text (not blank after stripping) is skipped for this field. It only exempts the field from that check; a rule of the field itself may still refuse the empty string, as the normalisation of source_dir does (source_dir = "" is an error). |
| nonblank | bool | Whether a text that is present, or each entry of texts, must not be empty after stripping; the entries of a list of prose and the policies of [pace] are. |
| items | tuple[Field, …] | The fields of a table or of each item of tables. |
| label | str | For tables, the key of the item field that names an item in messages (id, ref or option). |
| unique | bool | Whether the value of this field is unique among the items of its array. |
| advised | tuple[str, …] | A vocabulary that the loader does not enforce (the check reports a value outside it); the JSON Schema lists it as an enum. |
| doc | str | One sentence that says what the field is; the JSON Schema shows it as the description. |