LIVR icon indicating copy to clipboard operation
LIVR copied to clipboard

Validation of nested data structure

Open Shandur opened this issue 5 years ago • 2 comments

Hello! Could you, please, describe or provide some example of how can I validate nested data structure (parent->children->children and so on)? Can't figure the best way without repeating the same validation rule for field. For example, we have the next nested structure:

{
    id
    title
    children {
       id
       title
       children {....}
    }
}

Is it possible to validate structure with infinite/finite nesting without repeating validation rules for each children? Thanks!

Shandur avatar Aug 01 '19 15:08 Shandur

Hi, interesting case :) Do you mean that it can have infinitive depth? Is just several levels nested or really recursive?

koorchik avatar Aug 02 '19 10:08 koorchik

@koorchik For my case it should be 5 levels deep. Right now, I've just nested the same structure 5 times. But I think it'd be better to create a separate rule for that and make a PR if there is no "clean" way of doing that

Shandur avatar Aug 21 '19 14:08 Shandur