Documentation
    Preparing search index...

    Variable ModelValidatorConst

    ModelValidator: OptionalParameterizedPropertyDecorator<undefined> = ...

    Used to register a model method that will be called when an instance is being validated. Available as both an instance and static method (static method receives the model as a parameter).

    class User extends Model {
    @ModelValidator
    onValidate() {
    if (this.name !== VALID_NAME) {
    throw new Error(ERROR_MESSAGE);
    }
    }

    @ModelValidator
    static onValidate(instance) {
    if (instance.name !== VALID_NAME) {
    throw new Error(ERROR_MESSAGE);
    }
    }
    }

    See also ValidateAttribute.