I have an ASP.NET WebAPI project where I am attempting to replace our old XmlDocumentationProvider page with Swagger UI. I am using the swashbuckle swagger for webAPI 5.3.1 nuget package.
I am able to navigate to localhost/MyApp/swagger, and I can see in fiddler that it makes a call to localhost/MyApp/swagger/docs/v1 to retrieve the JSON string representing my API. The call succeeds, the JSON is about 240KB, and the JSON is valid. At this point, the chrome tab freezes for about 30 seconds before crashing with the "Aw snap" page. There are no errors in the console.
Attempting to validate the api JSON in this online validator works and says the spec/schema is valid IF AND ONLY IF I uncheck all three of the "Follow ___ $refs" checkboxes. If any of those boxes are ticked, it takes about 30 seconds and then that tool crashes.
Unfortunately I can't paste my entire webAPI spec somewhere, but I will say that it is for a very large and very complicated internal business application. Some of our DTOs have circular references (properties of the same type as the DTO itself) which I suspect may be causing a problem, but without any logging or debugging I cannot be sure, and with over 1000 DTO classes I don't want to comb through them all to check.
Is there any way to turn on any sort of logging or debugging for swashbuckle (on the server) or swagger UI (on the client)? Has anyone ran into this issue with the browser crashing and know what is causing it? Thanks ahead of time.
I was able to comment out each of my API controllers, load the swagger page, and then turn them back on until the page crashed again. Once I figured out which controller was the issue, I repeated the process with all of the endpoints in the controller.
It turned out that one of our very old methods was taking an ORM entity as a body parameter (very bad), which was causing swagger to try to parse our entire ORM object graph and running out of memory. Changing this method to accept a DTO instead of data layer entity solved the problem.