检查给定值是否为空(=== null, === undefined) ,如果是,则忽略属性上的所有验证程序 @Equals(comparison: any) Checks if value equals ("===") comparison. 检查值是否相等(“===”)比较 @NotEquals(comparison: any) Checks if value not equal ("!==") comparison. 检查值是否不相等(“!==”)比...
如果输入的等于null或者undefined,忽略其它的校验装饰器 Equals 等于某个确定的值 @Equals(5) NotEquals 不等于某个值 IsEmpty 检查这个值等于'',null,undefined。 IsNotEmpty 不能是空的,也就是不能是'',undefined,null IsIn 检查值是否是数组中的某个值 @IsIn(['1','2']) 输入的值必须是1,2中的一个...
@IsOptional()Checks if given value is empty (=== null, === undefined) and if so, ignores all the validators on the property.检查给定值是否为空(=== null, === undefined) ,如果是,则忽略属 性上的所有验证程序 @Equals(comparison:any)Checks if value equals ("===") comparison.检查值...
如果输入的等于null或者undefined,忽略其它的校验装饰器 Equals 等于某个确定的值 @Equals(5) NotEquals 不等于某个值 IsEmpty 检查这个值等于'',null,undefined。 IsNotEmpty 不能是空的,也就是不能是'',undefined,null IsIn 检查值是否是数组中的某个值 @IsIn(['1','2']) 输入的值必须是1,2中的一个...
@Equals(0) 报错信息 validate 方法返回的是包含ValidationError对象的一个数组 [{"target":{"data":{"house":{"name":"dddd","tags":["整租"]}},"code":2},"value":{"house":{"name":"dddd","tags":["整租"]}},"property":"data","children":[{"target":{"house":{"name":"dddd","ta...
notEquals(value, comparison); // Checks if value does not match ("!==") the comparison. validator.isEmpty(value); // Checks if given value is empty (=== '', === null, === undefined). validator.isNotEmpty(value); // Checks if given value is not empty (!== '', !== null...
594 validator.notEquals(value, comparison); // Checks if value does not match ("!==") the comparison. 595 validator.isEmpty(value); // Checks if given value is empty (=== '', === null, === undefined). 596 validator.isNotEmpty(value); // Checks if given value is not empty...
import { IsOptional, Equals, ClassPropertyTitle, validator } from 'class-validator-multi-lang'; class MyClass { @IsOptional() @Equals('test') @ClassPropertyTitle('property "title"') title: string = 'bad_value'; } const RU_I18N_MESSAGES = { '$property must be equal to $constraint1':...
@NotEquals(comparison: any) Checks if value not equal ("!==") comparison. @IsEmpty() Checks if given value is empty (=== '', === null, === undefined). @IsNotEmpty() Checks if given value is not empty (!== '', !== null, !== undefined). @IsIn(values: any[]) Checks ...
@Equals(comparison: any)Checks if value equals ("===") comparison. @NotEquals(comparison: any)Checks if value not equal ("!==") comparison. @IsEmpty()Checks if given value is empty (=== '', === null, === undefined). @IsNotEmpty()Checks if given value is not empty (!== '...