Swagger-ui 无法访问 JS 脚本 [英] Swagger-ui cannot access JS scripts

查看:67
本文介绍了Swagger-ui 无法访问 JS 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了 swagger-ui 安装,但我无法得到这个工作.问题是无法访问 java-script 文件.名称似乎是错误的 - index.html 需要 SwaggerUiStandalonePreset.js 而在 /dist 目录中只有 swagger-ui-standalone-preset.js.

I followed the swagger-ui installation and I cannot get this work. The problem is that java-script files are not accessible. It seems that the names are wrong - index.html expects SwaggerUiStandalonePreset.js and in /dist directory there is only swagger-ui-standalone-preset.js.

我认为这是一个问题,但是 github 上的免责声明 解释说:

I thought that this is a problem, but the disclaimer on github explains:

<!-- don't be alarmed, these don't match what's in dist, because webpack-dev-server serves them in memory. -->
<script src="/dist/SwaggerUIBundle.js"> </script>

现在该怎么办?

推荐答案

这种情况好像是新版swagger-ui的一个bug.

This situation seems to be a bug in new version of swagger-ui.

如果你想让这个应用程序工作,只需将 /dist 目录移动到你的 http 服务器的父目录并重命名以下文件:

If you want to make this application working just move /dist directory to parent directory of your http server and rename following files:

  • swagger-ui-bundle.js 到 SwaggerUIBundle.js
  • swagger-ui-standalone-preset.js 到 SwaggerUIStandalonePreset.js

这篇关于Swagger-ui 无法访问 JS 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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