When we’re setting docExpansion: 'none' in configuration, then giving someone a permalink to a particular endpoint inside a tag, and them clicking it doesn’t do anything for them.
After the page opens for them, all endpoints are still not expanded, as if there was no /#/permalink/part in the URL.
@michalrus, I'm not able to reproduce this.
For example: https://petstore.swagger.io/?docExpansion=none#/pet/addPet expands the pet tag and the POST /pet operation, as I would expect.
That’s true, hmmm. But… We’re using 3.19.3, like https://petstore.swagger.io/ — and this Petstore Swagger-UI deployment is not able to expand/deep-link our definition either, if I use ?url=our-swagger.json.
Can I give you a link to our deployment, so that you can verify that the issue indeed occurs? But the API is non-public, so I’d need a private way to contact you. Can I use the email from your profile?
@michalrus, sure, shoot me an email and I'll take a look!
Just sent. =)
@shockey Okay. I was able to minimize this.
So the problem is:
Permalinks don’t work: with tags, and docExpansion: 'none', for operations that don’t have an explicit operationId.
E.g. this works:
{
"swagger": "2.0",
"paths": {
"/ping": {
"get": {
"operationId": "blahBlah",
"produces": [ "text/plain;charset=utf-8" ],
"responses": { "200": { "schema": { "type": "string" } } }
}
}
}
}
This doesn’t:
{
"swagger": "2.0",
"paths": {
"/ping": {
"get": {
"produces": [ "text/plain;charset=utf-8" ],
"responses": { "200": { "schema": { "type": "string" } } }
}
}
}
}
It also seems that operationIds with underscores _ in them fail.
But dashes - work. This feels a bit inconsistent.
Also, tags with spaces don’t work.
Thanks for the update @michalrus!
I'm actually working on that in #4895 right now - I'll add your test cases from the definition you shared, and your notes above.
Thank you very much. =)
We’re auto-generating the swagger.json from Haskell’s types anyway, so it was easy to add autogenerated operationIds in form of PUT.v1.permission.role.RoleId.user.me.UserId etc. It also looks nicer in URLs than those generated fragments.
@michalrus, I'm not sure your minimized case is right on the money.
Both of these work for me (in Chrome on macOS):
Tag expansion (#/default) seems to work in both examples as well.
Did I misunderstand something? Let me know - trying to write a test case in my branch for #4895 that covers what you're seeing.
The _ problem is different, I think (and covered in #4895) - that is rooted in my ill-conceived implementation that escapes whitespace in deep link hashes with _ instead of the now-obvious %20.
my_operation_id, when parsed back into Swagger UI from the hash, becomes my operation id, which fails to match up with anything that Swagger UI knows about.
Tag expansion (
#/default) seems to work in both examples as well.
Yes, tag expansion does work, but if you compare those two URLs right after opening, side by side, you’ll see that:
operationId,operationId, both tag and operation are expanded. =)Thank you for all the work on this! :tada:
@michalrus, FYI, I've confirmed that both cases you identified are working on master (they were still broken after #4953, see #4960).
I'll cut releases tonight. Let's keep this open, you tell me if things look better on your end with the new version!
@michalrus, any updates here? How is 3.19.4 treating you w/r/t this bug?
It’s working! :sparkles:
Thank you very much. \^.\^