swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Request to support tag with `/` in deep-linking

Open krissss opened this issue 3 months ago • 2 comments

Content & configuration

Swagger/OpenAPI definition:

openapi: 3.0.0
info:
 title: test
 version: 1.0.0

paths:
 /test:
   get:
     tags:
       - abc/xyz
     responses:
       '200':
         description: OK
         content:
           text/plain:
             schema:
               type: string

Swagger-UI configuration options:

SwaggerUI({
  'deepLinking' => true,
})
#/abc%2Fxyz/get_test

Is your feature request related to a problem?

When click the get interface, the browser url will display hash like #/abc%2Fxyz/get_test, but after refreshing the page, the browser url will change, like #/abc/xyz.

Describe the solution you'd like

I check the deep-linking code. Current code decodeURIComponent first for hash, this will change #/abc%2Fxyz/get_test to #/abc/xyz/get_test

https://github.com/swagger-api/swagger-ui/blob/4dea377ca41ca88aaec3939ac7b720b99c17c10e/src/core/plugins/deep-linking/index.js#L13

And then in urlHashArrayFromIsShownKey and isShownKeyFromUrlHashArray, they only get first one or two splice

https://github.com/swagger-api/swagger-ui/blob/4dea377ca41ca88aaec3939ac7b720b99c17c10e/src/core/plugins/deep-linking/layout.js#L185

I think this can be simple changed for support tag has / in.

Possiable change is to split / first,then decodeURIComponent.

Describe alternatives you've considered

I checked the existing configuration and found no relevant configuration.

Swagger-ui also did not make it clear that deep-linking does not support /.

Some API management tools support the / in tag as the basis for grouping, such as ApiFox

Additional context

Nothing

krissss avatar Sep 10 '25 01:09 krissss

same as #5875

krissss avatar Sep 10 '25 02:09 krissss

assign me this

Khushi-J15 avatar Oct 02 '25 10:10 Khushi-J15