Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: Add download file option #1699
feat: Add download file option #1699
Changes from 3 commits
196a2a0
58b5497
b0ebdc0
4923037
16c80fd
f36137f
5f29219
e6c1c1d
f9f7ced
e310f1f
cecb737
32eebd0
6995a8e
d0b1309
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we ignore the yaml dumper as it adds a lot of code to the bundle: https://github.com/Redocly/redoc/blob/master/webpack.config.ts#L116
Can we instead implement a downloadUrl option so you can provide any URL and don't have Redoc to serialise the definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RomanHotsiy I'm not sure I understand what a
downloadUrl
option would entail. Are you suggesting users would provide their own URL for downloading a YAML API spec? If so, what if the URL they provide does not contain the API spec or is inaccessible?I had originally hoped that the original API spec file used to create the webpage would be available to use for download, but that did not seem to be the case or I did not know where to look for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original URL should work fine as long as you use URL and not use redoc-cli from a file on the filesystem (it should actually work like that but there may be a bug or something).
So I think it should work as below:
downloadUrl
.downloadUrl
was provided, then we just serialize it to json and use openapi.json as filename (JSON is free in terms of bundle size vs yaml).What do you think?
The purpose of this option is to provide the URL for download button. Why should anybody provide a bad URL there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't familiar with the multiple options for providing an API spec file; I believe our use case uses the redoc-cli.
So is there already an API spec URL that can be referenced in the code? Or are you suggesting this be added; if so, would this URL be used to generate the HTML or would it just be for downloading an API spec file?
I don't think it would be intentional, e.g. is it possible to use an internal or local company URL to generate the HTML pages? If so, that URL might not be accessible to the wider internet.