Closed kyyberi closed 6 years ago
Tested in Windows 8 with Chrome (latest version) browser and was able to reproduce it. Found the following violation messages in the console view
Swagger seems to be valid, but....
@kyyberi I fixedit via UI. Don't know what happened but I've got e-mail notification about error on the server side
SyntaxError: Error parsing "https://github.com/Metatavu/kunta-api-spec/blob/master/swagger.yaml"
end of the stream or a document separator is expected at line 313, column 24:
<!-- blob contrib key: blob_contributors:v21:d22dbc1c
and
RangeError: Maximum call stack size exceeded
Looks like the Swagger didn't parse the file and fall down with stack overflow
I'm not able to get it to load.
Problem still exists. This API is going to real use soon in one of our Smart city cases.
Same thing locally. I tried via
Also getting in console:
raven@2.2.1 alert: unhandledRejection captured: 9e46c6e3f0464545b27ee3f5ad607068
raven@2.2.1 alert: unhandledRejection captured: de552699f6b849b7970ba00e38bb01e2
raven@2.2.1 alert: unhandledRejection captured: bb343e3441c843e2adc47aa471308957
raven@2.2.1 alert: unhandledRejection captured: 849e464fc1cf4edfbec7ab468e6ac4e2
raven@2.2.1 alert: unhandledRejection captured: e88479a4a7b84a77a7162d69718ea987
Used URL https://raw.githubusercontent.com/Metatavu/kunta-api-spec/master/swagger.yaml @ http://petstore.swagger.io/. Perfectly works.
@55 that was the message from client as well.
Hi @55 i have checked this issue on "Google Chrome" and "mozilla" and i did't get this type of error . Please review below gifs
@kyyberi @55 It was link to the incorrect Swagger file with "circular references". The Swagger couldn't build the correct UI.
I went through entire file and resolved the circular references directly.
@marla-singer any ideas why it worked at http://petstore.swagger.io?
@55 Nope. It needs detailed investigation
@krashna-deligence interesting, what OS were you using?
ubantu 16.04
Investigation report
I thought the problem comes from library "swagger-parser":
I upgraded the library "swagger-parser" to v4.0.0 and I've got the same result
I went through the source code of library and didn't find any problem with a circular reference.
README.md says:
Supports circular references, nested references, back-references, and cross-references
Anyway, the swagger-parser returns the correct result but the client side doesn't receive it.
The error trace displays that the problem comes from EJSON
I tried to catch the error with "Maximum call stack size exceeded" but no success. The circular reference is the invalid type of JSON and EJSON can't work as expected.
Didn't think up any good idea about how to fix it or notice a user about this error
Tested in https://staging.apinf.io (release 0.52). The problem exists there with APIs having swagger documentation. screenshot of the exception caught is attached.
Exception
cc @saransh-dev
Yes, we need to check result
also in onCreated at line number 33 inside apinf_packages/api_docs/swagger_ui/swagger_ui.js
Currently we have like if (result.schemes && result.schemes[0] === 'http') {
and we need to make it like if (result && result.schemes && result.schemes[0] === 'http') {
@preriasusi - I cannot reproduce this on apinf.io, which is where the original error was first found. The later comments on this bug report are referring to another bug which was reported and fixed in another report. Please check, and if you agree, close this issue.
In apinf.io kunta-api seems to load swagger
Thanks, closing..
Steps to Reproduce:
Outcome:
Expected Behavior:
Load SwaggerUI
Environment:
Mac 10.12.6 , Chrome browser (l61.0.3163.100), APInf production site (https://apinf.io)