question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger UI endpoint expand/collapse issue

See original GitHub issue

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Chrome
  • Version: 70.0.3538.102
  • Method of installation: NuGet Package
  • Swagger-UI version: 3.19.5
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Swagger-UI configuration options:

app.UseSwaggerUI(c =>
 {
     c.SwaggerEndpoint("/swagger/v1/swagger.json", "Fifo API");
 });
?yourQueryStringConfig

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:

  1. Go to http:/localhost/swagger/
  2. Click on API Endpoint drop down (Make sure you have two endpoint with same name and different parameter)
  3. Now if you look it will expand all endpoint drop down with same & different parameters
  4. Same issue with collapse also.

Expected behavior

It should be expand only one API endpoint drop down which is got clicked

Screenshots

1. When page got loaded. image

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

Additional context or thoughts

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
hkosovacommented, Nov 16, 2018

It looks like several operations have the same operationId. Duplicate operationIds are not allowed by the OpenAPI Specification.

@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.

3reactions
intenzivecommented, May 1, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger UI - How can I expand all the operations by default?
I believe you can set the docExpansion:"full" when creating swagger-ui. See https://github.com/swagger-api/swagger-ui#parameters for details ...
Read more >
Configuration - Swagger Documentation
Swagger UI accepts configuration parameters in four locations. ... The default expansion depth for models (set to -1 completely hide the models).
Read more >
Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
For example, you can set whether each endpoint is expanded or collapsed, how tags and operations are sorted, whether to show request headers...
Read more >
Chapter 13. Using the Red Hat Quay API
Lets you connect to endpoints, via a browser, to get, delete, post, and put Red Hat Quay settings by enabling the Swagger UI;...
Read more >
Springdoc-openapi Properties
Parameter name Default Value Description springdoc.swagger‑ui.oauth2RedirectUrl /swagger‑ui/oauth2‑redirect.html String . OAuth re... springdoc.swagger‑ui.oauth.clientId String . Default cl... springdoc.swagger‑ui.csrf.enabled false Boolean . To en...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found