Swagger UI Displays,但出现"ERROR"错误,指标 [英] Swagger UI Displays but I get an "ERROR" indicator
问题描述
显示我的招摇用户界面,并且它显示了我的所有路线.一切看起来都很不错,除了右下角有一个红色的大ERROR指示灯.当我单击它时,会得到:
My swagger UI displays and it is showing all of my routes. Everything looks great except there is a big red ERROR indicator on the lower right. When I click it I get:
{
"schemaValidationMessages":[
{
"level":"error",
"message":"Can't read from file http://devxxxx.com:80/swagger/docs/v1"
}
]
}
如何解决此错误?
推荐答案
那是验证者徽章.该错误最有可能是因为在线验证程序无法达到您服务器(devxxxx.com)上的OpenAPI规范.我假设这台服务器位于防火墙后面.
That's the validator badge. The error is most likely because the on-line validator can't reach the OpenAPI spec on your server (devxxxx.com). I am assuming this server is behind a firewall.
根据Swagger UI的版本,您可能可以禁用验证器徽章.在2.x中,您只需在 index.html
中的 SwaggerUi
构造函数中添加 validatorUrl:null
.在3.x中,禁用验证器徽章存在问题.有关更多详细信息,请搜索 validatorUrl问题.
Depending on the version of Swagger UI, you may be able to disable the validator badge. In 2.x, you can simply add validatorUrl: null
to the SwaggerUi
constructor in index.html
. In 3.x, there have been problems disabling the validator badge. For more details search for validatorUrl issues over on GitHub.
这篇关于Swagger UI Displays,但出现"ERROR"错误,指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!