Closed wangshijun closed 1 year ago
Im open for a pr to add this feature
I have looked into Link, I am not looking to support this feature, I would suggest splitting up the schema into smaller schemas and reference them instead
What about cases where schema self-references?
const person = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
friends: Joi.array().items(Joi.link('#person'))
}).id('person');
I believe this is an option for self-references:
const person = Joi.object({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
friends: Joi.array().items(Joi.link('#person').meta({ className:'Person' }))
}).id('person').meta({ className:'Person' });
Yes this should work
Joi supports link to create nested schema: https://joi.dev/api/?v=17.7.0#linkref
But seems this tool does not support it.