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:
objectApply 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:
schema_provider (CasillaSchemaProvider)
deadline_checker (DeadlineChecker | None)
- validate(draft)[source]¶
Run every validation rule against
draft.- Parameters:
draft (
ModeloDraft) – TheModeloDraftto validate.- Return type:
- Returns:
A tuple of
ModeloValidationFindingitems, possibly empty.
- apply_validation(draft, findings)[source]¶
Return a
ModeloDraftcopy ofdraftwithfindingsand a fresh status.Status promotion logic:
Any
ERROR→ModeloDraftStatus.BORRADOR(still blocking).Any
WARNINGonly →ModeloDraftStatus.VALIDADO.No findings →
ModeloDraftStatus.LISTO_PARA_PRESENTAR.
- Return type:
- Parameters:
draft (ModeloDraft)
findings (tuple[ModeloValidationFinding, ...])
- derive_validation_status(findings)[source]¶
Return the machine validation status implied by
findings.- Return type:
- Returns:
The
ModeloDraftStatusderived from the severity of the findings.- Parameters:
findings (tuple[ModeloValidationFinding, ...])