[FEATURE] Recursion limit to examples
Is your feature request related to a problem? Please describe
to have control on the recursion in explicit examples
Describe the solution you'd like
from the documentation is see a similar stateful-recursion-limit=<N> when following links
maybe we can have a examples-recursion-limit=<N>
Lets say we have a tree with branches, each branch can have more branches. Currently i notice the value of N=7 (counted the nested 'branches' occurrences in below example)
{
"id":"415feabd",
"name":"Birch",
"description":"white birch tree",
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
There are two issues with current behavior:
- unable to control the recursion
- the final branch has no leaves (nested objects do not work for the final recursive call issue #2358 )
Expectation:
considering examples-recursion-limit=2
{
"id":"415feabd",
"name":"Birch",
"description":"white birch tree",
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}],
"branches":[
{
"name":"b1","leaves":[{"name":"l1"}]
}
]
}
]
}
]
}
Thanks for pointing out this!
Recursion is a bit complicated right now as it is done by inlining the referenced schema up to N times (7 in most cases). I want to rework how such schemas are processed and expose a way to control the depth - currently, it is in #2207 which is WIP.
I hope to get back to that PR and finish it, but it still requires a lot of work.