Skip to content
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

Infinite recursion for completions #353

Open
tamasfe opened this issue Nov 18, 2022 · 0 comments
Open

Infinite recursion for completions #353

tamasfe opened this issue Nov 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tamasfe
Copy link
Owner

tamasfe commented Nov 18, 2022

Schemas are crawled for completions with a given depth limit. However composite schemas (e.g. allOf, anyOf) are currently not counted as child schemas and will not count towards the schema depth. Thus it is possible to cause a stack overflow by mutually referencing schemas that are all composite schemas themselves (e.g. Target in https://raw.githubusercontent.com/metalbear-co/mirrord/main/mirrord-schema.json).

The fix itself is trivial, just treat composite schemas as children. However this will change the semantics of the user-provided limit that restricts the length of the suggested dotted keys.

To handle this properly:

  • We should treat the current depth as some internal hard-limit to prevent infinite recursions.
  • The user-defined limit will apply after all schemas are collected, thus will not affect performance anymore but purely UX.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant