Say one has a Joi schema like so:
public static Schema(): Joi.Schema {
return Joi.object({
description: Joi.string().max(MAX_STRING_LENGTH).required()
});
}
Can one pair it with allow() like so:
public static Schema(): Joi.Schema {
return Joi.object({
description: Joi.string().max(MAX_STRING_LENGTH).allow(null).required()
});
}
It seems that .required() overrides .allow(null)? e.g., if one runs this second snippet and attempts to provide null as a value it will be rejected saying that a string is required.
In other words, I think the answer to my question is no, you cannot pair required() and allow() together, allow() is overridden by required(). Is this correct?