I am trying to validate a schema that, along other fields, has an array of self-referenced objects like this:
export const answer = answerModel.concat(Joi.object().keys({
childAnswers: Joi.array().items(answer),
numArray: Joi.array().items(Joi.number()).required()
}))
My problem is that I cannot reference answer schema inside answers schema Joi.array().items(answer) since I cannot use it before I declare it.
Question is "is there any way to self-reference in this nested format for validation"?