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

feat: improves indirect recursion detection #46

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

ribeirobreno
Copy link
Contributor

Describe the pull request

This PR adds a recursion check by passing an array of parent schemas down the component chain and checking if a particular schema is already in it before rendering the object.

Sample schemas and unit tests were included to validate the issue is fixed by this change.

Why

These changes avoid the build hanging as described in #41

How

The .astro components involved in rendering schema objects all got a parents property which receives an array of SchemaObject representing their parents, in the SchemaObjectObjectProperties component the single parent property was replaced by the new parents property and the existing "parent" check now considers the array instead of the single object.

Copy link

vercel bot commented Sep 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
starlight-openapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 3:36pm

Copy link
Owner

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution 🙌

I took the liberty of changing the line endings to LF in one of the files so we can merge this PR right away but other than that, this looks really great to me, building on top of the existing check, improving it and adding tests for the changes. 🌟

@HiDeoo HiDeoo changed the title Fix #41 - Stop recursion feat: improves indirect recursion detection Oct 1, 2024
@HiDeoo HiDeoo merged commit 506675d into HiDeoo:main Oct 1, 2024
3 checks passed
@codeserk
Copy link

codeserk commented Oct 3, 2024

@HiDeoo is this change included in the latest version (0.8.0)? I think I'm facing a similar issue, the app crashes when trying to render a particular endpoint which is quite large and has loops 🤔 (dies because it gets out of memory, even if I increase it a lot - probably infinite loop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants