I am new to JSON. I have a schema mentioned as :
*
const schema = Joi.array().min(3).has({
Name: Joi.string().required(),
Type: Joi.string().required(),
Price: Joi.number().required(),
});
My JSON is like :
{
"foods": [
{
"Name": "Item1",
"Type": "Category1",
"Price": 14
},
{
"Name": "Item2",
"Type": "Category2",
"Price": 8
},
{
"Name": "Item3",
"Type": "Category1",
"Price": 10
}
]
}
But when I validating this, I am getting error as: joi validationerror 'value' must be an array.
Please let me know what needs to be changed in JSON object to be validated by the schema.