Skip to content

[Feature request] Support Joi.link() #105

@DanielNoveo

Description

@DanielNoveo

Please add functionality of Joi.link()
This would allow schemas to be recursive

Usage example: i have schema like this

const nestedThingValidator = Joi.object({
    type: Joi.string().required().valid(FIELD_TYPE.NESTED),
    format: Joi.string()
      .valid(FIELD_TYPE.BOOL, FIELD_TYPE.RADIOBUTTON, FIELD_TYPE.DROPDOWN)
      .required(),
    options: Joi.array()
      .items(
        Joi.object({
          value: Joi.string().required(),
          code: propertyCodeValidator,
          fieldset: Joi.array()
            .items(Joi.ref("#nestedOne"))
            .min(1),
        })
      )
      .required()
      .min(1),
  })
  .id("nestedOne");

Which allows object to be recursively nested

P.S. Here are a message i have with my schema when i try to convert it with this library
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions