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.

Disable "server" dropdown menu?

See original GitHub issue

Q&A (please complete the following information)

  • OS: OSX
  • Browser: Chrome
  • Version: Varies by developer, generally latest
  • Method of installation: NPM, via swagger-ui-express@2.0.8
  • Swagger-UI version: 3.1.4 (According to swagger-ui-express README)
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger/OpenAPI definition:

servers:
  - url: https://localhost:6021/api

Swagger-UI configuration options: No custom options specified. Using defaults.

Screenshots

image

How can we help?

We host the SwaggerUI with our API docs in the same app that provides the API. As part of that process, we programmatically modify the servers property of the yaml file to contain the correct server name for that instance. (So, for example, you get localhost with the proper port when working locally, the staging url when looking at staging, etc.) Because of this, there’s only ever one server in the definition when passed to SwaggerUI.

With this being the case, is there a way to disable the “server” dropdown in the swagger UI? With only one server ever available in the list, it seems to take up a lot of unnecessary space.

I suspect we’re just missing a simple configuration option, but I couldn’t find anything via the Power of Google. 😦

Thanks for any advice.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
michael-ocommented, Nov 25, 2019

I’d like to ask to reopen this one because the actual issues has not been solve. Making the CSS hack will visually hide the element, but not prevent from creating. I have the very same issue here. Our URL section:

servers:
  - url: "{contextUrl}/api/v1"
    description: Current Server

is actually filitered on the fly by Spring WebMVC.

0reactions
webroncommented, Nov 25, 2019

@michael-o it’s better to file a new issue because it was closed by the author. However, please read @hkosova’s comment as it provides a better solution overall.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to hide server descriptions in Swagger UI? - Stack Overflow
If you really don't want in dropdown then you can remove it from your server list. servers: - url: https://development.gigantic-server.com/v1 - ...
Read more >
How to disable the drop-down list in HTML5 ? - GeeksforGeeks
The drop-down is used to create a list of items that need to select an element. We use <select> and <option> elements to...
Read more >
How to disable an item of a dropdownlist? - MSDN - Microsoft
You can't "disable" items in a dropdownlist. A dropdownlist renders as an html Select element, and there are no properties that you can...
Read more >
Disable DropDownList Items for Selection - Kendo UI for jQuery
To prevent the future selection of disabled items, add an event handler to the select event and call e.preventDefault() . Edit Preview Open...
Read more >
DropdownMenu | Block Editor Handbook
In some contexts, the arrow down key used to open the dropdown menu might need to be disabled—for example when that key is...
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