class-validator
Version:
Class-based validation with Typescript / ES6 / ES5 using decorators or validation schemas. Supports both node.js and browser
16 lines (15 loc) • 586 B
TypeScript
/// <reference types="es6-shim" />
import { ValidationArguments } from "./ValidationArguments";
/**
* Custom validators must implement this interface to provide custom validation logic.
*/
export interface ValidatorConstraintInterface {
/**
* Method to be called to perform custom validation over given value.
*/
validate(value: any, validationArguments?: ValidationArguments): Promise<boolean> | boolean;
/**
* Gets default message when validation for this constraint fail.
*/
defaultMessage?(validationArguments?: ValidationArguments): string;
}