openapi-swagger用户界面没有响应大的响应

0aydgbwb  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(211)

我有一个springboot应用程序,并使用openapi来记录springrestapi。应用程序返回的有效负载非常巨大,因此swagger开始挂起并且不显示。我调查了这个公开的github问题https://github.com/swagger-api/swagger-ui/issues/3832. 其中一条评论建议关闭syntaxhighlight参数https://github.com/swagger-api/swagger-ui/issues/3832#issuecomment-698531637. 但是,我不确定在使用openapi时如何设置该参数。
我当前的代码为openapi创建了一个bean。课程如下。

@SpringBootApplication
public class SampleWebApplication extends SpringBootServletInitializer{

 public static void main(String[] args) {
  SpringApplication.run(SampleWebApplication.class,args);
 }

@Bean
public OpenAPI customOpenAPI(@Value("${spring.app.name}") String appDesciption, @Value("${version}") String appVersion) {
        return new OpenAPI()
                .info(new Info()
                                .title("test API")
                                .version(appVersion)
                                .description(appDesciption)
                                .termsOfService("http://swagger.io/terms/")
                                .license(new License().name("Apache 2.0").url("http://springdoc.org")));
    }

}

如果有任何其他方式来显示大型有效载荷时使用openapi请让我知道。谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题