Conditional validation with joi: Do one thing if a property value is greater than 4, otherwise do something else

前端 未结 0 674
囚心锁ツ
囚心锁ツ 2021-01-13 06:31

In joi, I know I can do:

.when(\'propertyName\', {
  is: 4,
  then: Joi.number().required(),
  otherwise: Joi.number()
    .strip()
    .optional()
    .allow         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题