-
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
How to disable 'Try it out' in 3.x #3725
Comments
I too need a way to disable Try It Out. I'm using OAP v3 with Swagger UI 3.3+, but my API uses Oauth2, so the Try It Out options always give 401 responses. Sigh. |
CC: #3544.
Yes! It requires a custom plugin, though. Here's the code: const DisableTryItOutPlugin = function() {
return {
statePlugins: {
spec: {
wrapSelectors: {
allowTryItOutFor: () => () => false
}
}
}
}
}
// elsewhere, when you call Swagger-UI...
SwaggerUI({
plugins: [
DisableTryItOutPlugin
]
}) If you don't have control of the call to Swagger-UI (if you're using a downstream library, for example), this isn't possible at the moment... but if there's significant demand, we'd consider adding a |
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. |
Hi, I was wondering if it's possible to disable the Try It Out button on a per-path or possibly tag basis? |
Just by the looks of search results on "disabling try it out" I'd say there's enough demand. Including me :) |
I'd also love disabling "try it out" by some annotation parameter :) |
@shockey thanks for that plugin sketch It (still) works as expected. Still no plans to make that feature configurable via a simple flag? I also thought it necessary to hide the parameter input fields; haven't found a way to do that with a plugin and resorted to CSS. .parameters-col_description input, .parameters-col_description select {
/* if you can't try out the call it also doesn't make sense to display input fields for the request */
display: none;
} |
Hi all - how to achieve this when running Swagger UI in docker ? |
@eshepelyuk Swagger UI now has the
|
@hkosova sorry, could you give a minimal docker version supporting this feature ? |
Another workaround that may work for some use cases is setting a false server in the specification, meaning any use of "Try It Out" will hit a non existent endpoint instead. This overrides the default URL of "/"
|
* swagger-ui v3.51.1 (see instructions here: https://github.com/peter-evans/swagger-github-pages) * disable "Try it out" feature (swagger-api/swagger-ui#3725 (comment))
There is a simple config setup for this approach:
In this case we wont have try-it-out button in the ui |
@RvdHNL @shockey how to fix it in
still not work 😢 |
can anyone please help on this? |
As there is no any other communication channel with you dev guys, i am opening this issue, which is basically a question:
I haven't found anywhere how to disable 'Try it out' button in swagger-ui version 3.x.
Is it possible ?
Thank you
The text was updated successfully, but these errors were encountered: