My request body can be a single JSON object or array of JSON objects:
Single JSON Object
{
"name" : "item 1",
"description" : "item 1 description"
}
Array of JSON Object
[{
"name" : "item 1",
"description" : "item 1 description"
}, {
"name" : "item 2",
"description" : "item 2 description"
}
]
I want to validate these cases via celebrate/Joi
export const Create = celebrate({
[ Segments.BODY ]: Joi.any() // how can I handle them here
});