UNPKG

node-web-mvc

Version:
25 lines (24 loc) 993 B
import { ClazzType } from '../../interface/declare'; import RuntimeAnnotation from '../../servlets/annotations/annotation/RuntimeAnnotation'; import type ValidationContext from '../ValidationContext'; import Validator from '../Validator'; import IConstraints from './IConstraints'; import { ValidateGroupType } from './Validated'; declare function EMPTY_GROUP(): void; export default abstract class Constraints implements Validator, IConstraints { static EMPTY_GROUP: typeof EMPTY_GROUP; __exclude_keys__: 'isValid' | 'getSize'; groups?: ValidateGroupType | ValidateGroupType[]; /** * 自定义验证失败时的提示消息 */ message?: string; /** * 校验值 * @param value */ abstract isValid(value: any, context: ValidationContext): Promise<boolean> | boolean; constructor(info: RuntimeAnnotation); static getConstraints(clazz: ClazzType | Function, groups: ValidateGroupType[]): RuntimeAnnotation<Constraints>[]; } export {};