如何在我的应用程序中集成swagger-ui

Neh*_*eha 12 swagger swagger-ui

我试图将swagger与骆驼项目整合在一起

按照这个例子https://github.com/smparekh/camel-example-servlet-rest-tomcat

如何使用此示例项目访问swagger-ui?

我在tomcat中删除了war文件.

并访问http:// localhost:8080/camel-example-servlet-rest-tomcat/api-docs我得到这个...

{"apiVersion":"1.2.3","swaggerVersion":"1.2","apis":[{"path":"/ user","description":"用户休息服务"}],"info": {"title":"用户服务","描述":"提供用户REST服务的Swagger的Camel Rest示例"}}

但我的问题是 - 如何访问swagger-ui/index.html?

访问swagger-UI的确切URL是什么?

Dol*_*ava 9

您必须将swagger-ui的dist文件夹的内容复制到项目的webapp文件夹中.

在index.html中,

  window.swaggerUi = new SwaggerUi({
  url: "http://petstore.swagger.wordnik.com/api/api-docs",
  dom_id: "swagger-ui-container",
Run Code Online (Sandbox Code Playgroud)

你必须用这个替换url

 http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请按照此链接集成swagger-ui.

https://github.com/swagger-api/swagger-ui