Agrest (just like GraphQL) is prone to "infinite include" problem unless special measures are taken, when a call specifies a very long (possibly circular) include. Previously we've dealt with it with hardcoded path length limit (300 chars). Let's make it more explicit, and allow the users to specify max allowed path "depth" in terms of the number of relationships.
It is a rare parameter that is not attached to an entity, but rather to the entire runtime (or an individual request).
Attribute includes will NOT be counted towards "max depth", so it will only control the depth of relationship includes.
0 depth means no relationships, 1 means only direct relationships, etc.
A negative value is invalid and causes exceptions
There's always a depth policy associated with each request with includes. The default (if not configured explicitly) is 100. Max possible depth is Integer.MAX_VALUE, which should be enough for any practical cases.
Agrest (just like GraphQL) is prone to "infinite include" problem unless special measures are taken, when a call specifies a very long (possibly circular) include. Previously we've dealt with it with hardcoded path length limit (300 chars). Let's make it more explicit, and allow the users to specify max allowed path "depth" in terms of the number of relationships.
0
depth means no relationships,1
means only direct relationships, etc.100
. Max possible depth isInteger.MAX_VALUE
, which should be enough for any practical cases.