I'm using joi@^17.4.0 and have a schema that looks like this:
settings: Joi.object({
isHidden: Joi.boolean(),
payoutData: Joi.object({
email: Joi.string().email(),
}),
}),
I would like to input the string 'settings.isHidden'
or 'settings.payoutData.email'
without hard coding each of these strings in the schema. Is there a way that I can make joi know that these strings are valid based on the object schema I already have? Currently, when I try to validate these strings I get a validation error that says those keys are not allowed.
Example object to validate:
{ 'settings.isHidden': false }
Hoek.reach()
to extract the rules. - Ankh