swagger 在线编辑器可以通过地址栏输入一个 YAML url 作为输入吗? [英] Can the swagger editor online take a YAML url as input through the address bar?

查看:16
本文介绍了swagger 在线编辑器可以通过地址栏输入一个 YAML url 作为输入吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想访问 https://editor.swagger.io/ 但需要 YAML 文件基于 URL 参数预加载.

所以如果我想查看 https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml,我应该可以将其作为输入提供给可通过 Internet 访问的 swagger 编辑器.p>

这可能吗?

解决方案

是的,Swagger Editor 支持 url 参数:

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

请注意,要从 GitHub/GitLab/Bitbucket/etc. 加载 OpenAPI 文件,您需要指定原始"文件.文件链接.

此外,要使其正常工作,托管 YAML/JSON 文件的服务器必须使用 HTTPS 和 支持CORS(即允许来自editor.swagger.io的跨域调用).

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?

解决方案

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).

这篇关于swagger 在线编辑器可以通过地址栏输入一个 YAML url 作为输入吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆