-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Ability to disable TopbarPlugin via SwaggerUIBundle parameter #3229
Comments
See swagger-ui issue swagger-api#3229
This would also be nice to have for the schemes selection. Currently I am working around this by using a |
We can extend the plugin interface itself in order to make it easier to disable things, but I'm against adding flags for enabling/disabling specific things to the core- I'd rather those things happen through the plugin interface we have than add another layer of abstraction. That being said, @ponelat wrote up up a way to disable entire plugins on the fly, though it would be a significant change to the plugin system as a whole: #3246. I think it would address this use case, and solve some other limitations we're facing as well. |
Looking at this again, I may have misinterpreted the intent. I would be open to a namespace in the main configuration object that allows for options meant for a specific plugin. We already have My main concern is how to set defaults for config options. It's a handy feature that we use in the core configs for many things. Off the top of my head, passing in defaults at plugin-register time (when the plugin passes in its components and Redux bits) would be a good option, though it increases the surface area of the plugin interface. |
Hi, the instructions at README, ".. remove Topbar plugin from presets..." (commenting PS#1: ideal is to remove the "false instruction" from README. PS#2: see other motivations for "please remove the TopBar" at https://stackoverflow.com/q/44803881 ;-) |
@ppKrauss if it helps, I was able to get it to work. Check out: http://cecil-assets.s3-website-us-east-1.amazonaws.com/swagger/ and do "view source" |
Thanks @tleyden! With your clues I am building an "alternative swagger-ui" of pure HTML (and no TopbarPlugin) at https://github.com/okfn-brasil/swagger-ui-html |
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. |
@nfroidure, removing |
Closing - per my comment in October, the best way to do this is to remove the Standalone preset and layout from your configuration :) |
Is ther a way to pass this settings with a environment variable. I want to disable the explorer bar in a docker based installation (docker-compose). |
setting |
For a Docker based installation, you will need to create your own Dockerfile to remove the preset however it's as simple as:
|
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?
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:
after:
swagger-ui version: commit 212396f
The text was updated successfully, but these errors were encountered: