Validation¶
Inspect an ExtractResult against the template's constraints.
validate ¶
Validate an ExtractResult against a template's constraints.
This is a pure inspection — it does not mutate result. The returned
Report carries every error surfaced during extraction (structural and
coercion problems) plus any constraint violations found in the canonical
data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ExtractResult
|
The output of |
required |
template
|
Template
|
The same |
required |
Returns:
| Type | Description |
|---|---|
Report
|
A |
check ¶
check(
path: str | Path,
template: Template,
*,
engine: Engine | None = None,
) -> tuple[ExtractResult, Report]
Run extract + validate in one call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the source file. |
required |
template
|
Template
|
A loaded |
required |
engine
|
Engine | None
|
See |
None
|
Returns:
| Type | Description |
|---|---|
ExtractResult
|
A tuple |
Report
|
canonical dict (even when there are errors — partial extraction is |
tuple[ExtractResult, Report]
|
the whole point); |
Report
dataclass
¶
Result of validating an ExtractResult against its template.
Attributes:
| Name | Type | Description |
|---|---|---|
errors_list |
list[Error]
|
The full list of |
The richer API surface (is_valid, errors(), error_count()) is
accessed as methods/properties, matching the pydantic idiom.