Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the swagger editor online take a YAML url as input through the address bar?

I want to access https://editor.swagger.io/ but need the YAML file to be preloaded based on a URL parameter.

So if I want to view https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml, I should be able to provide this as an input to swagger editor accessible over the internet.

Is this possible?

like image 220
user9445 Avatar asked Oct 24 '18 18:10

user9445


1 Answers

Yes, Swagger Editor supports the url parameter:

https://editor.swagger.io/?url=https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

Note that to load OpenAPI files from GitHub/GitLab/Bitbucket/etc., you need to specify the "raw" file link.

Also, for this to work, the server where the YAML/JSON file is hosted must use HTTPS and support CORS (i.e. allow cross-domain calls from editor.swagger.io).

like image 69
Helen Avatar answered Sep 25 '22 21:09

Helen