aeat.domain.filing._validator module

Cross-cutting validator for domain.filing drafts.

The validator is intentionally pure: it consumes a draft + the casilla collection it was built against and returns a tuple of ModeloValidationFinding records. It never raises — strict behaviour is the caller’s responsibility via fail_on_warning on build_draft().

class ModeloValidator(*, schema_provider, deadline_checker=None)[source]

Bases: object

Apply cross-cutting validation rules to a ModeloDraft.

The validator depends on Protocols, not concrete subpackages, so alternative casilla, formula, or deadline implementations can be supplied without touching the validator.

Parameters:
validate(draft)[source]

Run every validation rule against draft.

Parameters:

draft (ModeloDraft) – The ModeloDraft to validate.

Return type:

tuple[ModeloValidationFinding, ...]

Returns:

A tuple of ModeloValidationFinding items, possibly empty.

apply_validation(draft, findings)[source]

Return a ModeloDraft copy of draft with findings and a fresh status.

Status promotion logic:

Return type:

ModeloDraft

Parameters:
derive_validation_status(findings)[source]

Return the machine validation status implied by findings.

Return type:

ModeloDraftStatus

Returns:

The ModeloDraftStatus derived from the severity of the findings.

Parameters:

findings (tuple[ModeloValidationFinding, ...])