How can I set a standard message for Joi.ref?

Viewed 14

I am currently using Joi validation for my project. The relevant values are price and maximum price, where maximum is optional but must be bigger than price.

I am using Joi.number().greater(Joi.ref('price')) for maximum price and I get the error: "maxPrice" limit references "ref:price" which must be a number when I leave price empty.

How can I set a custom message for this?

(I have read the documentation, but couldnt find anything that worked for me.

0 Answers
Related