Why:
Would e.g. allow to express rules that are not fixed to a certain depth. Currently we can only constantly index forward or backward from the start or the end of the path.
With recursive rules we could :
check some rule X
use rewrite to "move" to a different path
use then to recurse back to the same rule when required
How:
Probably need to lazy-load/eliminate deep copy for that. Maybe even need to avoid JsonRef and only use its loader to resolve file locations.
This might need substantial rewrite if it's not possible to modify the parsing behaviour of pydantic to "shallow parse" the structures and build the "graph" of rules out of it.
Note:
Also, the whole thing immediately becomes Turing Complete (in an esoteric language sense), as we have string rewriting that can simulate 2 counters, state (current rule and pattern) and goto (then + $ref)
This is low priority, until a serious use-case for this feature arises.
Why: Would e.g. allow to express rules that are not fixed to a certain depth. Currently we can only constantly index forward or backward from the start or the end of the path.
With recursive rules we could :
rewrite
to "move" to a different paththen
to recurse back to the same rule when requiredHow: Probably need to lazy-load/eliminate deep copy for that. Maybe even need to avoid JsonRef and only use its loader to resolve file locations.
This might need substantial rewrite if it's not possible to modify the parsing behaviour of pydantic to "shallow parse" the structures and build the "graph" of rules out of it.
Note: Also, the whole thing immediately becomes Turing Complete (in an esoteric language sense), as we have string rewriting that can simulate 2 counters, state (current rule and pattern) and
goto
(then
+$ref
)This is low priority, until a serious use-case for this feature arises.