How to integrate swagger-ui in my application

前端 未结 5 1900
盖世英雄少女心
盖世英雄少女心 2021-01-04 08:06

I am trying to integrate swagger with camel project

following this example https://github.com/smparekh/camel-example-servlet-rest-tomcat

How do i access swa

相关标签:
5条回答
  • 2021-01-04 08:15

    To access swagger2 it is

    http://localhost:${port}/${contextPath}/swagger-ui.html
    
    0 讨论(0)
  • 2021-01-04 08:18

    These are your Swagger Docs:

    {"apiVersion":"1.2.3","swaggerVersion":"1.2","apis":[{"path"...
    

    Now you need Swagger-UI to consume them. You can install it anywhere. There is no hard requirement that you put Swagger-UI in your project. You just need to edit the index.html file to point to your docs path (the JSON output above.)

    0 讨论(0)
  • 2021-01-04 08:27

    You must copy the contents of the dist folder of swagger-ui into your project's webapp folder.

    In index.html,

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

    you must replace url with this

     http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs
    

    For details, Follow this link to integrate swagger-ui.

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

    0 讨论(0)
  • 2021-01-04 08:30

    You should use http://localhost:${port}/${contextPath}/swagger/index.html

    0 讨论(0)
  • 2021-01-04 08:37

    http://localhost:8080/camel-example-servlet-rest-tomcat/{basepath}/dist/index.html if you have copied dist folder as is. If you have renamed dist folder, use the new name instead of dist. replace basepath with basepath you have configured in web.xml. The code snippet for that looks like this:

    <init-param>
    <param-name>swagger.api.basepath</param-name>
    <param-value>/rest</param-value>
    </init-param>
    
    0 讨论(0)
提交回复
热议问题