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

Responses List bugs for duplicate schemas with different codes #177

Closed
theindexer opened this issue Jan 3, 2017 · 3 comments
Closed

Responses List bugs for duplicate schemas with different codes #177

theindexer opened this issue Jan 3, 2017 · 3 comments

Comments

@theindexer
Copy link

If you reference the same schema but have different status codes (we have a 200 and a 201 that share a response body), weird things happen. Clicking on the zippy for whichever status code wasn't last in the spec causes it to change to the other code, then expand on the next click.

Problem code appears to be https://github.com/Rebilly/ReDoc/blob/master/lib/components/ResponsesList/responses-list.ts#L45

The returned resp is shared by all the responses and so the last one out will do the final write to status code and boom :(

It seems like a simple clone with

Object.assign({}, this.specMgr.byPointer(resp.$ref));

was enough to fix my issue but haven't really tested or dug around in the code to see if there's a better way.

@RomanHotsiy
Copy link
Member

@theindexer thanks! simple clone was good solution.
I've already fixed it and added a testcase.
New version release is planned for tomorrow.

@RomanHotsiy
Copy link
Member

New version 1.7.0 has been released

@theindexer
Copy link
Author

Sweet, thanks!

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

No branches or pull requests

2 participants