I need to validate an array to check if it's elements are strings using joi. It always sends the error of "Inavlid tag".
// returned array from req.body
let tags = ["Vue", "React", "Angular"]
// joi shema
const schema = {
tags: Joi.array().items(Joi.string()),
};
const { error, value } = Joi.validate(tags, schema);
if (error) {
return res.status(400).send({ tagError: "Invalid tag" });
}