-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Swagger UI endpoint expand/collapse issue #5032
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
Comments
@nayanishdamania, can you provide your Swagger/OpenAPI document (at It'll be difficult to solve this without having a look at it - if it's non-public, feel free to email it to me at [email protected]. |
It looks like several operations have the same @nayanishdamania check the relevant annotations in your source code to make sure the operation IDs are unique, or open a ticket with the library you use to generate the spec. |
Closing due to inactivity. This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue. |
I am still having the same issue with Swagger UI (Swashbuckle.AspNetCore 4.0.1). Here is the OpenAPI document ( some code omitted which is not relevant to the issue ) So clicking either on path "/api/Attributes" or "/api/Attributes/{id}" will expand both of them. The annotations are respectively [HttpGet] and [HttpGet("{id}")] |
@intenzive your OpenAPI doc is not valid - if you paste it into https://editor.swagger.io it will tell you where the errors are. |
@hkosova as I said I have omitted some from the json. Just didn't want to show it public. If you send me an email I can send you the original OpenAPI doc. |
Have the same issue, @intenzive did you solve it? |
@mariuszkerl, unfortunately no. The problem comes from methods having same names with same http verbs but with different input parameters. Still looking for solution. |
For everyone still having problems here like me and @mariuszkerl, changing the route name of one of the methods with same name will solve the issue. |
It appears that having different route name for two controllers with same HTTP methods also leads to this behavior. @intenzive or @mariuszkerl - confirm? |
@mdzeko, just tested and I am not able to simulate the described behavior so I am not confirming. |
@intenzive found out that even if you have different route names but the same method name (c# in my case) then it leads to this behavior. Making sure method names differ across the app as well as route names fixes it for me. |
@mdzeko indeed. Many OpenAPI document generators (like Swashbuckle) use method names to create Swagger UI, in turn, uses |
i found that this is happening when you have duplicate method names (say Get() and Get(string s)) - they should be unique... if you replace to Get2(string s) - it should not happen |
Okay i dont know if some of you guys still have this problem, but i had kind of the same problem i a manage to fixed it.
But in the controller class we forgot to add the tag as below
Endpoints were still accessible but we couldn't toggle the menu. Hope it will help some of you. |
same here. solved it? |
I want to set only one API drop down to be expanded at a time. Anyone knows how to do it? |
You can user the @ApiOperation annotation from swagger in each of your versioned APIs for solving this issue like given below.
|
@kunaldo07 Were you able to do this? |
Q&A (please complete the following information)
Content & configuration
Swagger-UI configuration options:
Describe the bug you're encountering
I am using Swagger UI in AspDotNetCore WebApi Application
When Trying expand the API endpoint drop down from UI, It will be expand all the endpoint with same name & different parameter instead of expanding that specific one.
To reproduce...
Steps to reproduce the behavior:
Expected behavior
It should be expand only one API endpoint drop down which is got clicked
Screenshots
1. When page got loaded.

2. I have clicked on 3rd endpoint but all are expanded with same and different parameters

Additional context or thoughts
The text was updated successfully, but these errors were encountered: