app.schemas

Pydantic response models for the read-only catalog HTTP API.

Every model declares model_config = ConfigDict(from_attributes=True) so routers build responses directly from the plain dataclasses returned by the read services (app.services.search, app.services.record_detail, app.services.sources_view) with SomeSchema.model_validate(value); no router re-reads the storage port or domain modules directly.

Modules:

class app.schemas.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.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.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.FacetProjectOut(*, project, count)

Bases: BaseModel

Record count of one project within a source.

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

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

project: str
count: int
class app.schemas.FacetSourceOut(*, source_id, count, projects)

Bases: BaseModel

One source’s projects, for the filter select.

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

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

source_id: str
count: int
projects: list[FacetProjectOut]
class app.schemas.FacetsOut(*, sources)

Bases: BaseModel

Filter options for the search UI.

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

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

sources: list[FacetSourceOut]
class app.schemas.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.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.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.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.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.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.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.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.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.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.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.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.SourceOut(*, id, type, enabled, config_error, config_error_code, intake, published_ref, last_attempt_at, last_success_at, last_status, last_error, stale)

Bases: BaseModel

One source registration’s configuration and freshness.

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

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

id: str
type: str
enabled: bool
config_error: str | None
config_error_code: ConfigErrorCode | None
intake: list[IntakeKind]
published_ref: str
last_attempt_at: datetime | None
last_success_at: datetime | None
last_status: PollStatus
last_error: JsonValue
stale: bool