Skip to content

Validators

Validators implement focused, composable validation rules that compare ORM models against specifications.

Each validator: - operates on a single model - produces structured validation issues - is independent of execution order


Validator Protocol

Bases: Protocol


ColumnNullabilityValidator

Ensures required columns are not nullable.

Ensures required columns are NOT NULL in the ORM model.


ColumnPresenceValidator

Ensures all specified columns exist on the ORM model.

Ensures all specified columns are present on the ORM model.


PrimaryKeyValidator

Validates primary key presence, nullability, and alignment with specs.

Validates primary key presence and correctness.

Always-on: - PK must exist - PK columns must be NOT NULL

Spec-aware (if FieldSpec provided): - Spec PKs must exist in ORM - ORM PKs should be declared in spec


ForeignKeyShapeValidator

Validates structural correctness of foreign key definitions.

Validates structural correctness of foreign key definitions.