app.schemas.records

Response models for search results and the record detail page.

Field names match the app.services.search, app.services.record_detail and app.services.record_relationships dataclasses they are built from, so every model here reads straight off those dataclasses through model_validate (from_attributes=True); none of this module performs business logic.

class app.schemas.records.IssueOut(*, severity, code, message)

Bases: BaseModel

One validation finding.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

severity: Severity
code: IssueCode
message: str
class app.schemas.records.IssueCountsOut(*, error, warning)

Bases: BaseModel

Stored-issue counts of one record, by severity.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

error: int
warning: int
class app.schemas.records.SearchItemOut(*, id, title, source_id, project, path, ref, kind, record_kind, approval_state, approvable, issue_counts, erratum_for_title)

Bases: BaseModel

One search result row.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
title: str
source_id: str
project: str
path: str
ref: str
kind: RecordState
record_kind: RecordKind
approval_state: ApprovalStateCode
approvable: bool
issue_counts: IssueCountsOut
erratum_for_title: str | None
class app.schemas.records.SearchPageOut(*, items, total, page, page_size)

Bases: BaseModel

One page of search results.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

items: list[SearchItemOut]
total: int
page: int
page_size: int
class app.schemas.records.MetadataOut(*, id, adr_uuid, decision_date, decision_date_inferred, kind, record_kind, title, title_source, digest, previous_digest)

Bases: BaseModel

Identity and authored metadata of one record.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
adr_uuid: UUID | None
decision_date: date | None
decision_date_inferred: bool
kind: RecordState
record_kind: RecordKind
title: str
title_source: TitleSource
digest: str
previous_digest: str | None
class app.schemas.records.ProvenanceOut(*, source_id, project, path, ref, source_url, updated_at)

Bases: BaseModel

Where a record’s content came from.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source_id: str
project: str
path: str
ref: str
source_url: str | None
updated_at: datetime
class app.schemas.records.FreshnessOut(*, last_attempt_at, last_success_at, last_status, stale, intake)

Bases: BaseModel

Freshness of a record’s owning registration.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

last_attempt_at: datetime | None
last_success_at: datetime | None
last_status: PollStatus
stale: bool
intake: list[IntakeKind]
class app.schemas.records.OutboundLinkOut(*, link_type, target_uuid, target_id, target_title, resolution, ambiguous, candidate_ids)

Bases: BaseModel

One outbound link and how it resolved.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

target_uuid: UUID
target_id: UUID | None
target_title: str | None
resolution: Resolution | None
ambiguous: bool
candidate_ids: list[UUID]
class app.schemas.records.InboundLinkOut(*, link_type, source_id, source_title)

Bases: BaseModel

A link from another record to the one being viewed.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source_id: UUID
source_title: str
class app.schemas.records.ErratumOut(*, id, kind, ref, source_id, project, path, title, type, section, reported_by, reported_date, original_html, corrected_html, notes_html, approval_state, approvable, digest, updated_at, has_content)

Bases: BaseModel

One erratum (published or candidate) of the record being viewed.

approval_state is the erratum’s own state: pending / policy_missing = reported, accepted = verified, rejected, changed_since_acceptance; not_required means no review is required. has_content is false (and the content fields empty) for a row stored before erratum content was.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
kind: RecordState
ref: str
source_id: str
project: str
path: str
title: str
type: ErratumType | None
section: str | None
reported_by: str | None
reported_date: date | None
original_html: str | None
corrected_html: str
notes_html: str | None
approval_state: ApprovalStateCode
approvable: bool
digest: str
updated_at: datetime
has_content: bool
class app.schemas.records.ErrataSummaryOut(*, total, verified, reported, rejected, changed, proposed)

Bases: BaseModel

Counts of the record’s errata for the top notice.

total/verified/reported/rejected/changed count published errata only (not_required counts as verified); proposed counts candidate errata.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

total: int
verified: int
reported: int
rejected: int
changed: int
proposed: int
class app.schemas.records.ErratumContentOut(*, type, section, reported_by, reported_date, original_html, corrected_html, notes_html)

Bases: BaseModel

The structured content of an erratum (on its own page).

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: ErratumType | None
section: str | None
reported_by: str | None
reported_date: date | None
original_html: str | None
corrected_html: str
notes_html: str | None
class app.schemas.records.ErratumForOut(*, uuid, id, title, resolved)

Bases: BaseModel

The decision an erratum corrects, resolved like outbound links.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

uuid: UUID
id: UUID | None
title: str | None
resolved: bool
class app.schemas.records.SiblingOut(*, id, kind, source_id, project, path, ref, digest, title, decision_date, decision_date_inferred, approval_state, approvable)

Bases: BaseModel

One published or candidate row sharing a record’s identity.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
kind: RecordState
source_id: str
project: str
path: str
ref: str
digest: str
title: str
decision_date: date | None
decision_date_inferred: bool
approval_state: ApprovalStateCode
approvable: bool
class app.schemas.records.PolicySummaryOut(*, status, id, version, required, allow_self_approval)

Bases: BaseModel

The applicable approval policy, or why there is none.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

status: PolicyStatus
id: str | None
version: int | None
required: bool | None
allow_self_approval: bool | None
class app.schemas.records.DecisionProvenanceOut(*, record_id, kind, source_id, project, ref, path, source_url)

Bases: BaseModel

The decided row as it was at decision time.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

record_id: str | None
kind: str | None
source_id: str | None
project: str | None
ref: str | None
path: str | None
source_url: str | None
class app.schemas.records.DecisionSummaryOut(*, id, digest, current_digest, action, actor_issuer, actor_subject, actor_display, comment, policy_id, policy_version, provenance, created_at)

Bases: BaseModel

One append-only decision event of the record’s identity.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
digest: str
current_digest: bool
action: DecisionAction
actor_issuer: str
actor_subject: str
actor_display: str | None
comment: str | None
policy_id: str
policy_version: int
provenance: DecisionProvenanceOut
created_at: datetime
class app.schemas.records.DivergenceOut(*, kind, other_digest, other_record_ids, other_accepted, message)

Bases: BaseModel

Content divergence within the record’s identity.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

kind: DivergenceKind
other_digest: str
other_record_ids: list[UUID]
other_accepted: bool
message: str
class app.schemas.records.CompetingCandidateOut(*, id, ref, path, digest, approval_state, approvable)

Bases: BaseModel

Another candidate of the identity with different content.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

id: UUID
ref: str
path: str
digest: str
approval_state: ApprovalStateCode
approvable: bool
class app.schemas.records.ApprovalOut(*, state, needs_approval, digest, policy, history, approvable, approval_blocker, last_accepted_digest, can_decide, decide_blocked_code, decide_blocked_reason, divergence, competing_candidates)

Bases: BaseModel

Approval state of a record’s current content, for the caller.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

state: ApprovalStateCode
needs_approval: bool
digest: str
policy: PolicySummaryOut
history: list[DecisionSummaryOut]
approvable: bool
approval_blocker: str | None
last_accepted_digest: str | None
can_decide: bool
decide_blocked_code: str | None
decide_blocked_reason: str | None
divergence: DivergenceOut | None
competing_candidates: list[CompetingCandidateOut]
class app.schemas.records.RecordDetailOut(*, metadata, issues, rendered_html, provenance, freshness, outbound_links, inbound_links, errata, errata_summary, erratum, erratum_for, status, siblings, legacy_signoff_unverified, approval)

Bases: BaseModel

Everything the record detail page shows.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

metadata: MetadataOut
issues: list[IssueOut]
rendered_html: str
provenance: ProvenanceOut
freshness: FreshnessOut
errata: list[ErratumOut]
errata_summary: ErrataSummaryOut
erratum: ErratumContentOut | None
erratum_for: ErratumForOut | None
status: DisplayStatus
siblings: list[SiblingOut]
legacy_signoff_unverified: list[str]
approval: ApprovalOut
class app.schemas.records.DiffEndpointOut(*, digest, label, decided_at)

Bases: BaseModel

One side of a diff.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

digest: str
label: str
decided_at: datetime | None
class app.schemas.records.RecordDiffOut(*, base, target, reason, unified_diff, identical, lines_added, lines_removed)

Bases: BaseModel

A unified diff between two stored snapshots.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

base: DiffEndpointOut | None
target: DiffEndpointOut
reason: str | None
unified_diff: str
identical: bool
lines_added: int
lines_removed: int