如何在浏览器中查看<swagger-ui-url> /app.yaml内容而不是下载yaml文件?

时间:2018-04-03 10:39:43

标签: yaml swagger swagger-ui

我在我的后端使用swagger api文档工具,我需要在调用url时在浏览器中查看.yaml文件的内容。但相反,我总是最终下载文件。

这是我的SwaggerUI标记的内容:

<script>
  window.onload = function() {

  // Build a system
  const ui = SwaggerUIBundle({
    url: "./app.yaml",
    dom_id: '#swagger-ui',
    deepLinking: true,
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout"
  })

  window.ui = ui
  }
</script>

0 个答案:

没有答案
相关问题