部署 Spring Boot 应用程序时 Swagger UI 错误验证 [英] Swagger UI Error validation when deployed a spring boot application

查看:56
本文介绍了部署 Spring Boot 应用程序时 Swagger UI 错误验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Swagger-ui.html 由于验证在页面底部显示错误

Swagger-ui.html shows a error at the bottom of the page due to validation

`{"schemaValidationMessages":[{"level":"error","message":"Can't read from file https://www.example.com/v2/api-docs"}]}`

我对此进行了一些研究,并了解到我们需要关闭验证以消除错误.但是如何从 Spring Boot 应用程序中关闭它.?或者有什么方法可以在 Spring Boot 应用程序中编辑 swagger-ui.html?

I did some research on it and came to know that we need to turn off the validations to remove the error. but how to turn it off from spring boot application.? or is there any way to edit the swagger-ui.html in a spring boot app ?

推荐答案

我通过添加以下代码禁用验证解决了这个问题

I solved it by disabling the validation by adding the following code

`@Bean
 public UiConfiguration getConfig(){
        String validatorUrl = "validatorUrl";
        return new UiConfiguration(validatorUrl);
    }`

这篇关于部署 Spring Boot 应用程序时 Swagger UI 错误验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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