Skip to content

@mostlyrightmd/core/validator

readonly optional allowSourceDrift: string

Non-empty reason string. Presence skips the source-identity check.

readonly optional retrievedAt: string

Producer-stamped retrieval timestamp. Falls back to rows[i].retrieved_at.

readonly optional source: string

Producer-stamped source string. Falls back to rows[0].source if absent.


readonly retrievedAt: string

readonly rowCount: number

readonly source: string

registerValidators(validators, formats): void

Contribute compiled validators for schema ids core does not ship.

Idempotent, and it never replaces a core validator: a domain package cannot shadow a canonical schema by registering the same id. Call it once from the domain barrel that owns those schemas.

Readonly<Record<string, AjvValidator>>

Readonly<Record<string, Readonly<Record<string, FormatKind>>>> = {}

void


validateRows<Row>(rows, schemaId, opts): ValidateResult

Validate rows against the named canonical schema.

Returns { rowCount, source, retrievedAt } on success.

Throws SchemaValidationError (with Python-vocabulary violations[]) on structural / dtype / enum / required-column failures, OR SourceMismatchError when per-row source identity drifts.

Row extends Record<string, unknown> = Record<string, unknown>

readonly Row[]

string

ValidateOptions = {}

ValidateResult

SchemaValidationError — see violations vocabulary in the module header.

SourceMismatchError — per-row source column doesn’t match resolved source.

TypeError — allowSourceDrift is non-string.

RangeError — allowSourceDrift is empty after trim.