@eclipse-emfcloud/model-validation
Version:
Generic model validation framework.
22 lines • 917 B
TypeScript
import { Diagnostic } from './diagnostic';
/**
* Protocol for a validation algorithm on some model.
*
* @template K the type of model identifier in the validation service
* @template M the type of model validated by the validator
*/
export interface Validator<K, M extends object = object> {
/**
* Compute the validation state of the given `model`.
* A validator that does not provide any validation of the
* particular given `model` must return an `'ok'` diagnostic.
* A validator is not required to support validation of sub-models
* or individual elements of a model.
*
* @param modelId the unique identifier of the `model` to validate
* @param model the model to validate
* @returns the `model`'s validation state from the perspective of this validator
*/
validate(modelId: K, model: M): Promise<Diagnostic>;
}
//# sourceMappingURL=validator.d.ts.map