If I have some data like this:
params: {
fieldOne: {
a: 'a1',
b: 'b1'
},
fieldTwo: {
a: 'a2',
b: 'b2'
}
}
I'm trying to write a joi schema that will validate that params is an object with any keys, that have values as objects with a and b.
I'm struggling to figure out how to allow any key in the value of params, yet still validate the value.
const schema = joi.object().keys({
params: joi.object().required().keys({
// How to allow any keys here, but require that the value is an object with keys a and b?
})
});