-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support recursive references in json schema #98
Conversation
This is ready for review of the recursive feature itself, which is relatively limited in code. Refactoring and encapsulation changes, ported tests, errors and combined coverage check could be ignored in review. The rest of the work defined above will be done in a follow up to speed up merging this PR. |
2fa560a
to
5449ec5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through the recursive parts and everything looks right to me except for a bounds check that i commented on.
Appreciate you taking a look here! @dpsimpson 🚀 |
5449ec5
to
9c5936f
Compare
Closes #96
Implementing recursive references feature by walking the json shema and counting ins and outs with defined max recursion depth of 3. Defining recursion depth higher than that probably should not be done, since each +1 step on the depth blows up regex's size exponentially. For example, for simple referential json schema level 5 will produce regex size over 700K, which seems counterproductive and likely to introduce performance issues. It also breaks even
regex
sensible defaults withCompiledTooBig
error.Also, for this reason having more sophisticated ref counter (counting different entities with their own recursion depths) won't work in current json schema implementation.
TODO:
json_schema
tests to rustanyhow
tothiserror
, handle errors