swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Large API Max Call Stack Size Exceeded

Open ntregillus opened this issue 9 years ago • 3 comments

I have a rather large API document (see below json). When loading it into the swagger-ui, it never displays, and I get the following exception thrown in the dev tools console:

jsoneditor.min.js:1 Uncaught RangeError: Maximum call stack size exceeded at String.replace () at s.init (http://localhost:57065/swagger/lib/jsoneditor.min.js:1:18844) at new s (http://localhost:57065/swagger/lib/jsoneditor.min.js:1:191) at n.createEditor (http://localhost:57065/swagger/lib/jsoneditor.min.js:1:5655) at s.addObjectProperty (http://localhost:57065/swagger/lib/jsoneditor.min.js:2:15610) at http://localhost:57065/swagger/lib/jsoneditor.min.js:2:6622 at s (http://localhost:57065/swagger/lib/jsoneditor.min.js:1:1977) at s.preBuild (http://localhost:57065/swagger/lib/jsoneditor.min.js:2:6581) at s.n.(anonymous function) [as preBuild] (http://localhost:57065/swagger/lib/jsoneditor.min.js:1:417) at s.addObjectProperty (http://localhost:57065/swagger/lib/jsoneditor.min.js:2:15701)

I can copy the json content, which is rendered correctly by swashbuckle, and load it in the editor at editor.swagger.io, and it displays correctly without issue there.

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.X
How did you install Swagger-UI? nuget
Which browser & version? chrome
Which operating system? Win 10

Demonstration API definition

Large API doc example here as json. Large API doc example here as yaml.

Expected Behavior

Should display the ui with all endpoints in their tagged sections.

Current Behavior

only title, description and contact info is displayed with the following loading text:

Finished Loading Resource Information. Rendering Swagger UI...

image

Context

Trying to leverage standard swagger-ui to display documentation, rather than having to write duplicated info.

ntregillus avatar Nov 27 '17 21:11 ntregillus

Hey @ntregillus, that screenshot is actually of Swagger-UI 2.x! editor.swagger.io runs Swagger-UI 3.x, which is a complete rewrite, so that explains why it works there.

Can you point me to the package that you installed via nuget? Maybe we can nudge the maintainer to make 3.x available (all the ones I found there were 2.x).

shockey avatar Nov 27 '17 23:11 shockey

@ntregillus That json is not large, and the latest Swagger Ui can parse it just fine: http://nhc-noaa.azurewebsites.net/swagger/ui/index?url=http://nhc-noaa.azurewebsites.net/ntregillusSwagger.json&filter=#/

The issues have been raise on swashbuckle but there is not much progress there... I created my own fork and I'm using the latest: https://www.nuget.org/packages/Swagger-Net/

heldersepu avatar Nov 28 '17 19:11 heldersepu

Closing due to inactivity.

This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue.

shockey avatar Dec 04 '17 23:12 shockey