app.domain.validation¶
Validation of a loaded frontmatter mapping against the record schema.
parse_fields() validates every known field, applies the legacy
mappings (deprecates -> obsoletes, signed-off-by -> legacy
sign-off) and collects issues in a stable order. It never raises.
A document is an erratum if and only if its frontmatter has
erratum-for. Errata use type, section, reported-by and
date instead of decision-date; those fields on a decision are
reported as unknown. The retired erratum shape (kind: erratum,
any case, or any corrects: key) yields legacy_erratum_format
and creates no link. kind is obsolete: kind: decision is
reported with the obsolete_kind_field warning and the record
stays a normal decision; any other value yields bad_field_type.
An erratum whose erratum-for is its own uuid yields the
erratum_targets_itself error and has no corrects link (it is
still stored and browseable). updates/obsoletes are decision
relationships: on an erratum they are validated, then dropped with the
erratum_relationship_ignored warning. Whether erratum-for
names another erratum needs the target’s kind and is checked at read
time (erratum_target_is_erratum).
Public API: KNOWN_FIELDS, DECISION_FIELDS,
ERRATUM_FIELDS, LEGACY_ERRATUM_FIELDS,
FieldValues, parse_fields().
- app.domain.validation.DECISION_FIELDS = frozenset({'decision-date', 'deprecates', 'obsoletes', 'signed-off-by', 'title', 'updates', 'uuid'})¶
Frontmatter fields understood on a decision.
- app.domain.validation.ERRATUM_FIELDS = frozenset({'date', 'deprecates', 'erratum-for', 'obsoletes', 'reported-by', 'section', 'signed-off-by', 'title', 'type', 'updates', 'uuid'})¶
Frontmatter fields understood on an erratum.
- app.domain.validation.KNOWN_FIELDS = frozenset({'date', 'decision-date', 'deprecates', 'erratum-for', 'obsoletes', 'reported-by', 'section', 'signed-off-by', 'title', 'type', 'updates', 'uuid'})¶
Frontmatter fields understood by the catalog.
- app.domain.validation.LEGACY_ERRATUM_FIELDS = frozenset({'corrects', 'kind'})¶
Fields of the retired erratum shape (
legacy_erratum_format).
- class app.domain.validation.FieldValues(adr_uuid, title, decision_date, erratum, links, legacy_signoff, issues)¶
Bases:
objectValidated frontmatter values plus the issues found.
- Parameters:
adr_uuid (
UUID|None) – Record UUID,Noneif missing or invalid.decision_date (
date|None) – Authored decision date (the reportdatefor an erratum), if valid.erratum (
ErratumHeader|None) – Erratum frontmatter,Nonefor a decision.links (
Links) – Outbound links; empty when there is no valid UUID.legacy_signoff (
tuple[str,...]) – Legacysigned-off-byentries.
- erratum: ErratumHeader | None¶
- classmethod empty()¶
Build the values used when the frontmatter could not be read.
- Return type:
- Returns:
Values for a decision with no UUID and no links.