php-validate icon indicating copy to clipboard operation
php-validate copied to clipboard

字段的校验是通过empty判断存在时才进行validator吗?

Open Mr-GD opened this issue 2 years ago • 1 comments
trafficstars

现在有个场景,在参数约定remark字段为字符串,但自动化测试时remark给到了null,并没有触发string的校验,哪怕新写一个customStringValidator也不会触发: image image 这是service层参数打印: image 参数校验是放controller上,说明入参字段为null时,并不会触发验证器 注:验证器继承的是:Inhere\Validate\FieldValidation

Mr-GD avatar Oct 30 '23 03:10 Mr-GD

对,不加 required 都是值不为空才进入各个验证器

inhere avatar Oct 30 '23 13:10 inhere