Validation Reports¶
Validation reports provide a structured, machine-readable summary of validation outcomes.
They are suitable for: - CLI output - CI/CD pipelines - JSON serialisation - programmatic inspection
ValidationIssue¶
Represents a single validation finding.
Validation issues are immutable data records describing a deviation between an ORM model and an external specification.
Attributes:
| Name | Type | Description |
|---|---|---|
table |
str
|
Name of the table where the issue was found. |
level |
SeverityLevel
|
Severity level of the issue. |
message |
str
|
Machine-readable issue identifier. |
field |
Optional[str]
|
Optional field/column name associated with the issue. |
expected |
Optional[str]
|
Optional expected value or condition. |
actual |
Optional[str]
|
Optional actual value or condition. |
hint |
Optional[str]
|
Optional human-readable guidance. |
SeverityLevel¶
ValidationReport¶
Aggregate report of validation outcomes.
A ValidationReport collects all issues produced during validation and provides multiple representations suitable for: - interactive inspection - text reporting - JSON serialisation - CI/CD pipeline integration
__init__(*, model_version, model_name=None)
¶
Initialise a new validation report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_version
|
str
|
Version identifier for the validated model set. |
required |
model_name
|
Optional[str]
|
Optional human-readable model name. |
None
|
add(issue)
¶
Add a validation issue to the report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
issue
|
ValidationIssue
|
Validation issue to record. |
required |
exit_code()
¶
Return a process exit code suitable for CI/CD pipelines.
Returns:
| Type | Description |
|---|---|
int
|
1 if any ERROR-level issues are present, otherwise 0. |
is_valid()
¶
Return whether the report contains no issues.
Returns:
| Type | Description |
|---|---|
bool
|
True if no issues are present, otherwise False. |
render_text_report()
¶
Render a human-readable multi-line text report.
Issues are grouped by table and rendered with simple visual indicators for severity.
Returns:
| Type | Description |
|---|---|
str
|
Formatted text report. |
summary()
¶
Return a one-line human-readable summary.
Returns:
| Type | Description |
|---|---|
str
|
Summary string including error, warning, and info counts. |
to_dict()
¶
Return a structured dictionary representation of the report.
Intended for use in CI/CD pipelines and programmatic consumers.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary representation of the validation report. |
to_json()
¶
Serialise the report to a JSON string.
Returns:
| Type | Description |
|---|---|
str
|
JSON-formatted validation report. |