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

openapi: do not overflow the stack for circular types #133

Merged
merged 1 commit into from
Nov 2, 2022
Merged

openapi: do not overflow the stack for circular types #133

merged 1 commit into from
Nov 2, 2022

Conversation

pyr
Copy link
Contributor

@pyr pyr commented Oct 15, 2022

When JSON schema types reference each other, the example generation code blows up the stack. This patch adds a simple mechanism to avoid going more than (a completely arbitrarily chosen value of) 5 layers deep[1].

This patch correctly fixes the panic I was previously experiencing

[1]: it felt like anything more than 5 would make reading the example complex anyhow.

When JSON schema types reference each other, the example
generation code blows up the stack. This patch adds a simple
mechanism to avoid going more than (a completely arbitrarily chosen
value of) 5 layers deep.
@eliottness
Copy link

This bug is happening to me as well. I would really like this MR to be merged 👍

Copy link
Owner

@danielgtaylor danielgtaylor left a comment

Choose a reason for hiding this comment

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

Thanks! Given large examples are currently hidden and replaced with <input.json anyway I think the limit of 5 here is reasonable. 👍

@danielgtaylor danielgtaylor merged commit cff7978 into danielgtaylor:main Nov 2, 2022
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.

None yet

3 participants