Swagger-ui: UI crashes when the definitions contain circular references

Created on 2 May 2017  路  4Comments  路  Source: swagger-api/swagger-ui

v3.0.8 tries to fix #2923 #2889, but it seems the essential issue still exists.
It fixes only self-reference thing:
http://petstore.swagger.io/?url=https://gist.githubusercontent.com/sgyang/6dc266a27871ed6da9aaaa8ff144b683/raw/06d9f5d5193bfcb50c22ee04f9b3aaf9c863a8eb/ok-swagger.yaml
But if the definitions have indirect mutual references, the UI crashes with maximum call stack size exceeded error:
http://petstore.swagger.io/?url=https://gist.githubusercontent.com/sgyang/97b914b4b853dba2bea38ae0746967a3/raw/04ba9158af71838d6ca2e9ebc6505e14502c0ec3/not-ok-swagger.yaml
http://petstore.swagger.io/?url=https://raw.githubusercontent.com/oasis-tcs/odata-openapi/master/examples/example.openapi.json

P1 lock-bot bug 3.x

Most helpful comment

This is fixed, pending next release of swagger-js.

All 4 comments

It might be a good idea to have a setting that specifies the max depth it should serialize.

That way it has a clear endpoint for these indirect circular references and the user/developer has a lot of control over how much they need to see vs how much time it will take to build out every time.

According to what we planned, it wasn't supposed to serialize any depth, but do that on the fly. This is definitely not the intended behavior.

This is fixed, pending next release of swagger-js.

I'm releasing UI in a few moments, the build I made for this version does not have issues with the last two specs OP provided. Closing!

All: if you have any further issues, please reply here or file a new issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings