在线的swagger编辑器可以通过地址栏输入一个YAML url吗? [英] Can the swagger editor online take a YAML url as input through the address bar?
问题描述
我想访问 https://editor.swagger.io/ 但需要 YAML 文件根据 URL 参数预加载.
I want to access https://editor.swagger.io/ but need the YAML file to be preloaded based on a URL parameter.
所以如果我想查看 https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml,我应该能够将其作为输入提供给可通过互联网访问的 swagger 编辑器.
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.
这可能吗?
推荐答案
是的,Swagger Editor 支持 url
参数:
Yes, Swagger Editor supports the url
parameter:
请注意,要从 GitHub/GitLab/Bitbucket/等加载 OpenAPI 文件,您需要指定原始"文件名.文件链接.
Note that to load OpenAPI files from GitHub/GitLab/Bitbucket/etc., you need to specify the "raw" file link.
此外,为此,托管 YAML/JSON 文件的服务器必须使用 HTTPS 和 支持 CORS(即允许来自 editor.swagger.io
的跨域调用).
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
).
这篇关于在线的swagger编辑器可以通过地址栏输入一个YAML url吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!