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.

Ability to disable TopbarPlugin via SwaggerUIBundle parameter

See original GitHub issue

There are README instructions on how to disable the TopBar, which is really helpful.

Would a PR be considered that would make it even easier – for example a parameter in SwaggerUIBundle?

  // Build a system
  const ui = SwaggerUIBundle({
    ...
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    presets_config: {
       SwaggerUIStandalonePreset: {
           TopbarPlugin: false
       }
    }
    ...
  })

  window.ui = ui
}

There would be a new section called presets_config that would allow parameters to be passed for things like disabling the TopbarPlugin. This is just a rough idea, and I haven’t really looked much at the swagger-ui codebase at all.

Here’s the before vs after:

screen shot 2017-06-10 at 1 30 48 pm

after:

screen shot 2017-06-10 at 1 30 22 pm

swagger-ui version: commit https://github.com/swagger-api/swagger-ui/commit/212396f24d0d0f072d06c6af71087d6fddef9134

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

50reactions
nfroidurecommented, Oct 13, 2017

Drop it here since it may help. I managed to remove the top bar on the latest version by simply doing:


    const ui = SwaggerUIBundle({
      url: "/static/swagger.api.json",
      dom_id: `#${ DOM_ID }`,
      presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIStandalonePreset.slice(1) // here
      ],
      plugins: [
        SwaggerUIBundle.plugins.DownloadUrl
      ],
      layout: "StandaloneLayout"
    })

Looks like a hack, but works out of the box.

14reactions
shockeycommented, Oct 13, 2017

@nfroidure, removing SwaggerUIStandalonePreset entirely, along with layout: "StandaloneLayout", should work as well 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger UI - Hide definition URL path - Stack Overflow
In Swagger UI 3.x, you can hide the top bar in one the following ways. Option 1. Edit dist\index.html and find this code:...
Read more >
Configuration - Swagger Documentation
When used and Topbar plugin is enabled, the url parameter will not be parsed. ... Enables overriding configuration parameters via URL search params....
Read more >
Fix Swagger Validator errors in Power Platform connectors
Operations using the “GET” HTTP method can't have a body or form data. ... Your swagger needs to remove operation parameter duplicates.
Read more >
springdoc-openapi v2.0.2
Automatically generates documentation in JSON/YAML and HTML format APIs. This documentation can be completed by comments using swagger-api ...
Read more >
arnoldad/swagger-ui - Docker Image
As a node module, swagger-ui-dist also exports the swagger-ui-bundle and ... When used and Topbar plugin is enabled, the url parameter will not...
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