SyncValidationRegistry
Defined in: libs/language/src/typeqlite-validate-sync.ts:44
A registry whose wrapper keeps a synchronous check synchronous.
wrapValidationException is protected and ValidationRegistry is a DI slot, so this is
Langium’s own extension point rather than a fork. The override keeps the wrapper’s actual job —
catch a throwing check and report it as a diagnostic instead of letting it escape — and returns
the check’s own result, so a genuinely async rule still surfaces as a promise and
validateSync refuses it rather than ignoring it.
Extends
Section titled “Extends”Member summary
Section titled “Member summary”Constructors
| Name | Description |
|---|---|
| new SyncValidationRegistry() | Inherited from langium. |
Accessors
| Name | Description |
|---|---|
| checksAfter | Inherited from langium. |
| checksBefore | Inherited from langium. |
Methods
| Name | Description |
|---|---|
| getAllValidationCategories() | Inherited from langium. |
| getCheckArray() | The checks applicable to the given type, as a plain array. |
| getChecks() | Inherited from langium. |
| register() | Register a set of validation checks. |
| registerAfterDocument() | Register logic which will be executed once after validating all the nodes of an AST/Langium document. |
| registerBeforeDocument() | Register logic which will be executed once before validating all the nodes of an AST/Langium document. |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SyncValidationRegistry(
services):SyncValidationRegistry
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:140
Parameters
Section titled “Parameters”services
Section titled “services”Returns
Section titled “Returns”SyncValidationRegistry
Inherited from
Section titled “Inherited from”ValidationRegistry.constructor
Accessors
Section titled “Accessors”checksAfter
Section titled “checksAfter”Get Signature
Section titled “Get Signature”get checksAfter():
ValidationPreparation[]
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:199
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”ValidationRegistry.checksAfter
checksBefore
Section titled “checksBefore”Get Signature
Section titled “Get Signature”get checksBefore():
ValidationPreparation[]
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:198
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”ValidationRegistry.checksBefore
Methods
Section titled “Methods”getAllValidationCategories()
Section titled “getAllValidationCategories()”getAllValidationCategories(
_document):ReadonlySet<ValidationCategory>
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:200
Parameters
Section titled “Parameters”_document
Section titled “_document”Returns
Section titled “Returns”ReadonlySet<ValidationCategory>
Inherited from
Section titled “Inherited from”ValidationRegistry.getAllValidationCategories
getCheckArray()
Section titled “getCheckArray()”getCheckArray(
type,categories?): readonlyValidationCheck<AstNode>[]
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:162
The checks applicable to the given type, as a plain array.
getChecks is called once per AST node during validation, and building a lazy stream
pipeline for each of them is a significant share of validation time - the more so because
most node types have no checks registered at all. The resolved list depends only on the
registered entries, so it is computed once and cached.
Parameters
Section titled “Parameters”string
categories?
Section titled “categories?”Returns
Section titled “Returns”readonly ValidationCheck<AstNode>[]
Inherited from
Section titled “Inherited from”ValidationRegistry.getCheckArray
getChecks()
Section titled “getChecks()”getChecks(
type,categories?):Stream<ValidationCheck<AstNode>>
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:153
Parameters
Section titled “Parameters”string
categories?
Section titled “categories?”Returns
Section titled “Returns”Stream<ValidationCheck<AstNode>>
Inherited from
Section titled “Inherited from”ValidationRegistry.getChecks
register()
Section titled “register()”register<
T>(checksRecord,thisObj?,category?):void
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:149
Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function) or an array of validation checks.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”checksRecord
Section titled “checksRecord”Set of validation checks to register.
thisObj?
Section titled “thisObj?”unknown
Optional object to be used as this when calling the validation check functions.
category?
Section titled “category?”Optional category for the validation checks (defaults to 'fast').
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ValidationRegistry.register
registerAfterDocument()
Section titled “registerAfterDocument()”registerAfterDocument(
checkAfter,thisObj?):void
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:196
Register logic which will be executed once after validating all the nodes of an AST/Langium document. This helps to finally evaluate information which are collected during the checks on the AstNodes.
As an example, for validating unique fully-qualified names of nodes in the AST, here the map with all the collected nodes and their names is checked and validation hints are created for all nodes with the same name.
Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation. Therefore it is recommended to clear stored information before validating an AST to validate each AST unaffected from other ASTs AND after validating the AST to free memory by information which are no longer used.
Parameters
Section titled “Parameters”checkAfter
Section titled “checkAfter”thisObj?
Section titled “thisObj?”unknown
Optional object to be used as this when calling the validation check functions.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ValidationRegistry.registerAfterDocument
registerBeforeDocument()
Section titled “registerBeforeDocument()”registerBeforeDocument(
checkBefore,thisObj?):void
Defined in: node_modules/langium/lib/validation/validation-registry.d.ts:179
Register logic which will be executed once before validating all the nodes of an AST/Langium document. This helps to prepare or initialize some information which are required or reusable for the following checks on the AstNodes.
As an example, for validating unique fully-qualified names of nodes in the AST, here the map for mapping names to nodes could be established. During the usual checks on the nodes, they are put into this map with their name.
Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation. Therefore it is recommended to clear stored information before validating an AST to validate each AST unaffected from other ASTs AND after validating the AST to free memory by information which are no longer used.
Parameters
Section titled “Parameters”checkBefore
Section titled “checkBefore”a set-up function which will be called once before actually validating an AST
thisObj?
Section titled “thisObj?”unknown
Optional object to be used as this when calling the validation check functions.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”ValidationRegistry.registerBeforeDocument
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.