hapijs / joi

The most powerful data validation library for JS
Other
20.96k stars 1.51k forks source link

Clarify Joi.ref documentation to work with arrays. #2899

Open redwert opened 1 year ago

redwert commented 1 year ago

What are you trying to achieve or the steps to reproduce ?

Please update the documentation for joi.ref. The example part to:

{
    x: {
        a: Joi.any(),
        b: {
            c: Joi.any(),
            d: Joi.ref('c'),
            e: Joi.ref('...a'),
            f: Joi.ref('....y')
        },
        c: Joi.array().items({
          g: Joi.ref('....a'),
        }),
    },
    y: Joi.any()
}

It is not clear that the array needs one more level and dot to get to the grandparent.

Marsup commented 1 year ago

Sure, would you submit a PR for that?

redwert commented 1 year ago

I am happy to do this. But this comment relates to the website https://joi.dev/api Is there a repo with documentation?

Marsup commented 1 year ago

It's all in https://github.com/hapijs/joi/blob/master/API.md, joi.dev just aggregates this.