Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger JSON fails to load #6

Closed
jcoryatjr opened this issue Apr 13, 2017 · 5 comments
Closed

Swagger JSON fails to load #6

jcoryatjr opened this issue Apr 13, 2017 · 5 comments
Assignees

Comments

@jcoryatjr
Copy link

Following the directions, open the Swagger demo, place the link to the swagger definition (in this case JSON) and explore, causes an error to be thrown by the swagger app "Failed T Load Spec".

Details shows:
{"messages":["malformed or unreadable swagger supplied"],"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"type","message":"instance type (string) does not match any allowed primitive type (allowed: [\"object\"])","schema":{"loadingURI":"#","pointer":""},"instance":{"pointer":""}}]}

@ms-AlexDavis
Copy link
Contributor

ms-AlexDavis commented Apr 13, 2017

Hi jcoryatjr,

I'm unable to reproduce the error you are referring to. You can download the yaml or JSON file from this projects docs directory and then import it on http://editor.swagger.io/#!/

If you wish to use the swagger UI, (A demo can be found at http://petstore.swagger.io/) you can paste in the URL from github in the top right. If you do this, make sure you use the raw link. (for instance, https://raw.githubusercontent.com/Microsoft/MSRC-Microsoft-Security-Updates-API/master/docs/swagger.yaml ).

Can you tell me if the swagger fails to validate on either of those sites for you? You should expect there to be a warning on the yaml (there are two response definitions, one for xml, one for json... you will get a warning that one isn't being used). and two warnings in the json (the one above, plus a warning that there is an unknown JSON tag for a comment). Both of these should be there, and won't cause the swagger to not validate.

@ms-AlexDavis ms-AlexDavis self-assigned this Apr 13, 2017
@ms-AlexDavis
Copy link
Contributor

I have identified an issue which might be the source of your error message. Swagger just released a new editor which does not validate our swagger document. The error message was different than yours however. Can you check http://editor2.swagger.io/ (which is the old editor) to see if your error persists?

@jcoryatjr
Copy link
Author

@ms-AlexDavis I did exactly as you mentioned in your first response. That is what generated the error.
I just tried the older editor importing the following url:
https://github.com/Microsoft/MSRC-Microsoft-Security-Updates-API/blob/master/docs/swagger.json

and got the following error:

YAML Syntax Error
End of the stream or a document separator is expected at line 290, column 22:
Jump to line 289
Details
Object
yamlError: n(t,e){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString
level: 900
type: "YAML Syntax Error"
description: "End of the stream or a document separator is expected at line 290, column 22:
<!-- blob contrib key: blob_contributors:v21:4f00b4e7 ...
^"
lineNumber: 289

I am behind a corporate firewall, would that have an effect on using the swagger UI? I did download and run the client version and came up with the same errors as initially mentioned.

@jcoryatjr
Copy link
Author

What I was able to do is to view the swagger definition as raw, copy it to the buffer and paste it into the UI editor to get it to load successfully.

Going to http://editor2.swagger.io/ and then importing a url supplying github url to the swagger definition continues to return the error.

@ms-AlexDavis
Copy link
Contributor

I assume it must be something on your corporate network. pasting the raw json url link into editor2 works for me the same as copy pasting the actual json.

Im going to close the issue since you found a suitable work around, if you run into any more issues, feel free to open another issue,

stmoor pushed a commit that referenced this issue Feb 4, 2021
Merge from microsoft/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants