Infinite nesting object with yup validation?

872 Views Asked by At

I have an object that may contain children of the same type of object, potentially making it infinite nested.

{
  command: Yup.string(),
  children: [
             {
                 val1: Yup.string(),
                 val2: Yup.string(),
                 val3: Yup.string(),
             },
             {
                 command: Yup.string(),
                 children: [] // nesting children here
             }
            ]
}

how can I validate the above object with yup ?

0

There are 0 best solutions below