LIVR
LIVR copied to clipboard
Validation of nested data structure
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!
Hi, interesting case :) Do you mean that it can have infinitive depth? Is just several levels nested or really recursive?
@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