If I have two fields, I\'d just like to validate when at least one field is a non empty string, but fail when both fields are empty strings.
Something like this does
An alternative way of using Joi.when() that worked for me:
var schema = Joi.object().keys({ a: Joi.string().allow(''), b: Joi.when('a', { is: '', then: Joi.string(), otherwise: Joi.string().allow('') }) }).or('a', 'b')
.or('a', 'b') prevents a AND b being null (as opposed to '').
.or('a', 'b')
a
b