zalando-incubator / hexo-theme-doc

A documentation theme for the Hexo blog framework
https://zalando-incubator.github.io/hexo-theme-doc
Other
247 stars 56 forks source link

`Maximum call stack size exceeded` when swagger.yaml spec contains circular $ref #129

Open ouadi opened 6 years ago

ouadi commented 6 years ago

Expected Behavior

swagger_ui and swagger_to_html should render a Swagger spec that contains circular $ref.

Actual Behavior

hexo generate or hexo server crash and show the following error:

INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
  RangeError: Maximum call stack size exceeded
    at Object._prettifyError (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/nunjucks/src/lib.js:36:11)
    at /home/yo/tmp/experiment-hexo/ozd-docs/node_modules/nunjucks/src/environment.js:545:19
    at eval (eval at _compile (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/nunjucks/src/environment.js:615:18), <anonymous>:9:11)
    at tryCatcher (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/home/yo/tmp/experiment-hexo/ozd-docs/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)

The issue is at the level of swagger-ui and is known (see UI crashes when the definitions contain circular references). It has been already fixed.

The question is: how to force hexo-theme-doc to use the fixed version of swagger-ui?

Steps to Reproduce the Problem

  1. have a swagger spec with circular $ref
  2. have a source file that uses swagger_ui tag or swagger_to_html tag
  3. execute hexo generate or hexo s

Specifications

rbarilani commented 6 years ago

@ouadi There isn't way "to force" to use a specific version of swagger_ui at the moment, plus we have to investigate if that's really just a problem of "swagger-ui" or it happens when we parse the spec....

ouadi commented 6 years ago

Will it be possible to suggest a work-around for the time being? With this issue, my very first use of hexo-theme-doc to document an API is completely blocked. I highly appreciate you help.

bhaskarmelkani commented 6 years ago

Hey,

Sincere apologies for a delayed response. Since the issue with swagger-ui is already fixed and we are using relaxed versioning(^) for it so you should get the update without any change. I am also updating the version of swagger-ui to the latest version. For swagger-to-html, I will fix the issue but it might take some time.

ouadi commented 6 years ago

Many thanks for your valuable help and involvement. I will wait for the fix.

ghost commented 5 years ago

Issue has been raised here: https://stackoverflow.com/questions/57370292/swagger-system-js461-rangeerror-maximum-call-stack-size-exceeded-using-ma

ghost commented 5 years ago

@All - Any updates on this please ?