Does Swagger UI have permalinks for paths?

前端 未结 1 1002
执笔经年
执笔经年 2020-12-19 10:35

Is it possible to link to a specific path displayed in Swagger UI, such as to /work/2.1 on the image below?

相关标签:
1条回答
  • 2020-12-19 11:05

    Yes, Swagger UI has permalinks for operations and tags. To get a permalink, expand an operation or tag and copy the URL in the address bar. Permalinks look like this:

    index.html#/tagName
    index.html#/tagName/operationId
    

    When someone opens such a permalink in a browser, the corresponding tag or operation is automatically expanded and also scrolled to the top if needed. Example:
    http://petstore.swagger.io/#/store/getInventory


    In Swagger UI 2.2 permalinks are enabled by default.

    If you use UI 3.x, you need version 3.0.19 or later, and you need to add deepLinking: true to the Swagger UI init code in your index.html:

    const ui = SwaggerUIBundle({
      url: "http://petstore.swagger.io/v2/swagger.json",
      deepLinking: true,  // <------
    
    0 讨论(0)
提交回复
热议问题