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

Recursive schema reference errors #45

Open
dadardy opened this issue Feb 27, 2019 · 6 comments
Open

Recursive schema reference errors #45

dadardy opened this issue Feb 27, 2019 · 6 comments
Assignees
Labels

Comments

@dadardy
Copy link

dadardy commented Feb 27, 2019

Loving the openapi-gui so far and would like to use it, but some of my schemas have recursive references at the child level and at the grandchild level. This causes callstack errors in Chrome and "too many recursion" errors in Firefox when clicking a schemas edit icon.

Any chance you can add in child schema tracking to detect recursion and render recursive schema children, grandchildren, etc... with a placeholder like they do in redoc?

Thanks!

@MikeRalphson
Copy link
Contributor

I've built a webpack bundle from reftools which has better recurse and dereferencing routines, so I will move over to that.

I don't suppose you have a short repro test case you could share?

Thanks for reporting!

@MikeRalphson MikeRalphson self-assigned this Feb 27, 2019
@dadardy
Copy link
Author

dadardy commented Feb 27, 2019 via email

@dadardy
Copy link
Author

dadardy commented Feb 27, 2019

Not sure if the sample will come through on my email reply. Here it is again just in case.

openapi.json.txt

@MikeRalphson
Copy link
Contributor

Ok, it was the jsonEditor component itself which couldn't handle the recursive schemas, so now we replace the recursive properties with $refs again (after dereferencing them originally). I still don't think it's the ideal component for editing / viewing complex schemas, but I'm still looking for a good replacement.

It would be great if you could retest and confirm the crash is gone.

@dadardy
Copy link
Author

dadardy commented Feb 28, 2019

Hi Mike,

It loads now without any recursion errors. But any object that gets opened up, the $ref paths get all messed up now when downloading the schema after viewing it in the jsonEditor.

See the User component in the schema below. The $ref on properties of the User components are now "#/items/oneof/...." instead of "#/components/..."

openapi.json.txt

Thanks again for looking into this recursion issue!

@MikeRalphson
Copy link
Contributor

OK, I've moved the 'fix' to another branch and reverted it on master for now, until the $ref path is fixed and tested. Shouldn't take long as the routine used has an option for this.

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

No branches or pull requests

2 participants