Skip to content

TypeQLiteValidator

Defined in: libs/language/src/typeqlite-validator.ts:148

TypeQLite’s validation checks, as methods. registerValidationChecks registers them with the services’ validation registry; the runtime runs them synchronously through validateSync.

Constructors

Name Description
new TypeQLiteValidator() Creates a TypeQLiteValidator.

Methods

Name Description
checkAnnotationNotEnforced() An annotation the runtime does not enforce — reported on every parse, never refused.
checkAnnotationsOnDefinition() Every annotation on a definition sits on a subject that admits it — ADMITTED in typeqlite-annotations.ts — and the definition’s value, if any, is a value type and belongs on an attribute.
checkAnnotationsOnRedefine() The same table on a redefine: its one change is a type-level annotation, a value type’s, or a trait (whose own check runs on the trait node).
checkAnnotationsOnTrait() Checks the annotations on an owns, relates or plays trait against the ones that subject admits.
checkLabelsAreUnique() TypeDB labels are unique across all types, not per kind.
checkNoDuplicateOwns() Owning the same attribute twice is idempotent when the two say the same thing — owns price, owns price — and refused when they disagree, on @key or any annotation, or one is ordered: which would win is not the writer’s to guess.
checkReservedKeywords() Reserved keywords parse here and fail only against a real TypeDB.
checkValueVariablesBound() Every variable a let or a comparison reads is bound somewhere in the match — by a concept pattern or another let.

new TypeQLiteValidator(): TypeQLiteValidator

TypeQLiteValidator

checkAnnotationNotEnforced(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:156

An annotation the runtime does not enforce — reported on every parse, never refused.

One rule, one message shape, for every kind: the annotation’s name comes from the node’s own keyword, so adding an annotation to the grammar and registering it above is the whole cost of reporting it.

Annotation

ValidationAcceptor

void


checkAnnotationsOnDefinition(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:179

Every annotation on a definition sits on a subject that admits it — ADMITTED in typeqlite-annotations.ts — and the definition’s value, if any, is a value type and belongs on an attribute. The AST carries three lists per definition because an annotation belongs to the thing it follows: entity player sub person @abstract puts @abstract on the sub, where TypeDB refuses it, and only a split list can say so.

AttributeDef | EntityDef | RelationDef | TypeExtensionDef

ValidationAcceptor

void


checkAnnotationsOnRedefine(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:239

The same table on a redefine: its one change is a type-level annotation, a value type’s, or a trait (whose own check runs on the trait node). The subject is the kind keyword’s, or type when the redefine names the type bare.

RedefineType

ValidationAcceptor

void


checkAnnotationsOnTrait(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:270

Checks the annotations on an owns, relates or plays trait against the ones that subject admits. A list (owns name[], relates parent[]) admits @distinct besides.

OwnsTrait | PlaysTrait | RelatesTrait

ValidationAcceptor

void


checkLabelsAreUnique(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:380

TypeDB labels are unique across all types, not per kind. Recorded the hard way in tracker.schema.typeqlite: a relation named task beside the entity of that name fails with [SVL2] Label 'task' should be unique, but is already used by 'entity', which is why the relation is called project-task.

DefineClause

ValidationAcceptor

void


checkNoDuplicateOwns(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:418

Owning the same attribute twice is idempotent when the two say the same thing — owns price, owns price — and refused when they disagree, on @key or any annotation, or one is ordered: which would win is not the writer’s to guess.

EntityDef | RelationDef

ValidationAcceptor

void


checkReservedKeywords(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:401

Reserved keywords parse here and fail only against a real TypeDB.

DefineClause

ValidationAcceptor

void


checkValueVariablesBound(node, accept): void

Defined in: libs/language/src/typeqlite-validator.ts:466

Every variable a let or a comparison reads is bound somewhere in the match — by a concept pattern or another let. $v == $a; $v > $h; with no let $v is TypeDB’s “The variable ‘v’ must be bound to a value before it’s used”, and it is a compile-time refusal there, so it is one here — not a zero-row answer from the engine.

Pipeline

ValidationAcceptor

void

TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.