Closed shreyas-agnihotri closed 6 years ago
Would be ideal if this could be specified as a tag attribute.
<redoc spec-url='swagger.yaml' no-download-openapi lazy-rendering>
Would you be able to apply some custom CSS to hide it?
As someone who has consumed many third-party APIs I do appreciate being able to easily download specs so my code can use it too, though :)
There aren't enough classes to really write a "good" css selector but this seems to work, at least in the new 2.0 alpha version, I don't have the prior version handy to see if the markup is the same.
.api-content .api-info > p {
display: none !important;
}
The .api-content
part of that selector really isn't necessary, but I wanted it to be very specific.
Anyway, I agree, there really needs to be a config option to disable rendering of the button entirely. For my current usage, we have a private API that we control access to the docs via user login, since our api changes over time and is private, we don't want anyone downloading it.
@willvincent @bartfeenstra thanks for answering.
I will definitely add a config option to hide this button.
It seems that even if the button is hidden, the spec still downloads to the browser, if that's what the page uses to render the docs. So, the user is still capable of saving it, if that's what they are after doing.
I guess just hiding the button would be fine for most people.
New option will be added in the upcoming redoc@1.21.0
- hide-download-button
Usage:
<redoc spec-url="..." hide-download-button> </redoc>
Important: THIS DOESN'T MAKE YOUR SPEC PRIVATE! As @adamaltman mentioned, the spec still downloads to the browser so the user is still capable of saving it.
Released in 1.21.0
This doesn't seem to work when using the React component.
render() {
return (
<div>
<RedocStandalone specUrl="/Specs/home.yaml" hide-download-button />
</div>
);
Figured it out:
<RedocStandalone specUrl="/Specs/home.yaml" options={{ "hideDownloadButton": true }} />
if you are using the cli you can use --options='{"hideDownloadButton": true}'
Can anyone confirm where this option should be added/defined?
I added it here in the redoc.html file within /templates
<script src="/script/redoc.standalone.js"> </script>
</body>
<script language="JavaScript">
Redoc.init(
'/{{documentationId}}/apispec',
{
nativeScrollbars: true,
noAutoAuth: true,
requiredPropsFirst: true,
hideHostname: true,
hideSchemaTitles: true,
menuToggle: true,
pathInMiddlePanel: false
hideDownloadButton: true
},
document.getElementById('redoc-container'));
</script>
And the redoc pages no longer rendered!
@sionlane I think you're missing a comma after pathInMiddlePanel: false,
.
great, thanks
is it possible to hide the "Download" button from the .yaml file?
If you need your spec to be private, you can use redoc to render the spec offline, save the resulting output, and then host only that output.
New option will be added in the upcoming
redoc@1.21.0
-hide-download-button
Usage:
<redoc spec-url="..." hide-download-button> </redoc>
Important: THIS DOESN'T MAKE YOUR SPEC PRIVATE! As @adamaltman mentioned, the spec still downloads to the browser so the user is still capable of saving it.
Thank you
hideDownloadButton: true not working with me? docs: https://redocly.com/blog/hide-download-button/
@vfa-tanna use theme.openapi.hideDownloadButton parameter example :
redocly build-docs spec.yaml --output=spec-front.html --template redoc-template.html --theme.openapi.hideDownloadButton
Is there an easy way to hide this button/functionality? We don't want to expose this option to our users.