Skip to content

Deep linking does not work for operations with tags containing spaces #4120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
linelson opened this issue Jan 16, 2018 · 6 comments
Closed

Comments

@linelson
Copy link
Contributor

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 2.0
Which Swagger-UI version? 3.9.1 (current)
How did you install Swagger-UI? Built using npm run build, copied dist folder
Which browser & version? Chrome 63.0.3239.132, Edge 41.16299.15.0
Which operating system? Windows 10

Demonstration API definition

Change the tag "pet" in the sample petstore.json to be "pet v1" or any other value containing a space.

Expected Behavior

Example operation: POST /pet with the tag "pet v1"
The link http://localhost:3200/#/pet_v1/addPet (replace localhost with whatever the host is) should result in the UI scrolling to the operation POST /pet.

Current Behavior

The UI does not scroll to the linked operation when the operation tag contains a space. In this example, the id of the html element for the operation POST /pet is "operations-pet v1-addPet".

Possible Solution

In this example, the element id of the operation POST /pet is "operations-pet v1-addPet". The space in this id breaks linking. The element id in this example should probably instead be "operations-pet_v1-addPet".

Context

Users expect that the linked operation should be scrolled to.

@jobec
Copy link

jobec commented Apr 10, 2018

Also bumped into this. Would be great if it was fixed.

@jobec
Copy link

jobec commented Apr 10, 2018

let isShownKey = ["operations", tag, operationId]

If I change this line into

let isShownKey = ["operations", tag.replace(/ /g, "_"), operationId]

it starts working. But I think it isn't meant to be solved that way.

Too bad I don't have the spare time to properly get accustomed with the source code to do a proper merge request.

@heldersepu
Copy link
Contributor

heldersepu commented Apr 11, 2018

This is causing issues on the CURL the issue was reported on #4263
Also a hash (#) on the tags causes a problem with the links as well:
http://swagger-net-test.azurewebsites.net/swagger/ui/index?filter=Sample

@MarvGilb
Copy link

Is there any progress on the pull request? Or any update if this will be fixed soon?

@jobec
Copy link

jobec commented Aug 30, 2018

Same question here.any target date to resolve this?

@shockey
Copy link
Contributor

shockey commented Oct 18, 2018

#4953 should solve this 😄 thanks for the report!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants