I have the same problem reported before in #1195
@webron could you test this :
Tested in private / anonymous mode :
Google-Chrome Version 59.0.3071.86 (Official Build) (64-bit) - LInux
Firefox 53.0.3 (64-bit) - Linux
Google-Chrome Version 58.0.3029.110 (64-bit) Windows
Open : https://editor.swagger.io/#/
Menu - > File -> Clear Editor
Open Again : https://editor.swagger.io/#/
Shows Petstore
Open : https://editor.swagger.io/#/?import=https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/uber.yaml
Still with petstore
Try to reopen any url with import
Still with petstore
Menu -> FIle -> Import URL
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/yaml/uber.yaml
Works fine and shows uber API
Aha! I thought you meant the import from the menu. The import with URL isn't implemented yet - it's in the known issues.
This is a huge bother when trying to edit files locally and verify things in the editor for changes. A fix on this would be a big QOL improvement.
Aha! I thought you meant the import from the menu. The import with URL isn't implemented yet - it's in the known issues.
The import from URL in the file-menu seems to work for me?
The import from the file menu works, it's only the query parameter that isn't. We'd welcome PRs :)
I also need import parameter to work. Can this be prioritized and implemented asap?
We don't have the capacity to implement all features at the moment. If this feature is important to you, consider submitting a PR and we'll do our best to review it as soon as possible.
This the same issue I am running into. Trying to use [urlparam param=uniqueid] for a url query parameter and it doesn't work. Any suggestions?
@dynostudios how is that the same issue?
Oops, I guess I posted on the wrong thread. I had a few open and there were a chain of links that lead me here.
Well, I found url=link_to_json can work.
Just to add a bit to the comment from @shenghu.
The url setting works as specified in https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md
So, you can simply add ?url=http://url.to/swagger.yaml and it will load it on initial load
As noted above, import is now url in v3 :smile:
I'm going to close this out and remove the item from the known issues; feel free to bump this thread if there are any outstanding concerns.
I'm still having trouble with using this parameter within my API; initially I thought it was down to using Content-Type rather than a file extension, but there seems to be something else going on. Here are two URIs, one modeled very closely on the other:
https://cdn.rawgit.com/OAI/OpenAPI-Specification/55a4c6d8/examples/v2.0/yaml/uber.yaml
http://www.mocky.io/v2/5a6fbae1300000e5336fe69f/uber.yaml
However, it seems to me that:
https://editor.swagger.io/?url=https://cdn.rawgit.com/OAI/OpenAPI-Specification/55a4c6d8/examples/v2.0/yaml/uber.yaml
works, but:
https://editor.swagger.io/?url=http://www.mocky.io/v2/5a6fbae1300000e5336fe69f/uber.yaml
loads the default Petstore example (obviously you'll need to clear the editor between calls).
Any ideas what causes this difference in behavior?
Actually, I'm answering this on my own behalf... I think it's the mingling of http and https causing the problem. So you'll need to use https://editor.swagger.io if your documentation is hosted via HTTPS, and http://editor.swagger.io if you're hosting via HTTP.
@jackwhelpton I was just writing a response :smile: you're correct, HTTPS pages can't fetch HTTP resources, it's a browser security thing!
Here is another question:
If the imported URL is like: http://example.com?file=example.yml&token=abcdefgh, should we need escaping (since ?, = and & are keywords in actual URL).
Is it time to update the README.md to remove "Importing specs from a URL is not implemented." ?
@abliss indeed it is! feel free to open a PR for that if you'd like the contribution credit 馃槃
Still import URL feature is not working?, it is loading petstore yaml only.
I tried following both options but no luck, It would be great if can integrate with github/alm-git/bitbucket repositories.
https://editor.swagger.io/#/?import=
https://editor.swagger.io/#/?url=
Most helpful comment
Well, I found
url=link_to_jsoncan work.