-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pass ReDoc UI Parameters using the JavaScript API instead of HTML Tags #25
Pass ReDoc UI Parameters using the JavaScript API instead of HTML Tags #25
Conversation
Reviewer's Guide by SourceryThis pull request addresses issues with passing ReDoc UI parameters by switching to the JavaScript API for parameter handling and updating the ReDoc version from an old release candidate to the officially released version 2. The changes ensure that parameters are passed correctly, even if they contain single quotes or falsy values, and fix the issue with the download button being always hidden. File-Level Changes
Tips
|
WalkthroughThe changes in the Changes
Poem
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Hey @eltoder - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟡 Complexity: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/openapipages/redoc.py (5 hunks)
- tests/test_redoc.py (1 hunks)
Additional comments not posted (5)
tests/test_redoc.py (1)
13-14
: Updated assertions correctly reflect the new Redoc version and configuration key.src/openapipages/redoc.py (4)
22-22
: Updated configuration key to camelCase aligns with JavaScript conventions.
38-38
: Updated CDN URL to the official release of Redoc version 2 enhances reliability.
76-76
: Using JSON serialization for UI parameters enhances robustness and flexibility.
103-111
: Correctly updated HTML template to use the new configuration key and CDN URL. The script initialization is properly formatted.
d23df94
to
5a66600
Compare
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/openapipages/redoc.py (5 hunks)
- tests/test_redoc.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- src/openapipages/redoc.py
- tests/test_redoc.py
@hasansezertasan could you please take a look? |
Thank you @eltoder for your interest 🙏. I'm bit busy lately 🤖. I will take a look at this whem I get the chance 😇 |
Currently passing redoc UI parameters has the following issues: * It puts json-ed values of parameters in single quotes, which breaks if the value itself contains single quotes. * If the value is falsy, only the name of the parameter is used. This syntax is *not* treated as falsy by redoc. The latter causes the download button to be always hidden, because the default parameters have "hide-download-button": False. There is no way to un-hide it with the current code. Change this to use the javascript API to pass UI parameters[1], which is much simpler and more robust. Also, stop using the "next" version of redoc, as suggested here[2]. This was an old release candidate for version 2. Use the officially released version 2. [1] https://redocly.com/docs/redoc/deployment/html/#the-redoc-object [2] fastapi/fastapi#9700
5a66600
to
0b508eb
Compare
Hi @hasansezertasan! I resolved the conflict. Please take another look. |
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/openapipages/redoc.py (5 hunks)
- tests/test_redoc.py (1 hunks)
Files skipped from review due to trivial changes (1)
- tests/test_redoc.py
I'll take a look at it when I get the chance. Thank you for the effort 🙏. |
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.
Thanks for the PR @eltoder 🎉🎉🎉
Currently passing redoc UI parameters has the following issues:
The latter causes the download button to be always hidden, because the default parameters have "hide-download-button": False. There is no way to un-hide it with the current code.
Change this to use the javascript API to pass UI parameters[1], which is much simpler and more robust.
Also, stop using the "next" version of redoc, as suggested here[2]. This was an old release candidate for version 2. Use the officially released version 2.
[1] https://redocly.com/docs/redoc/deployment/html/#the-redoc-object
[2] fastapi/fastapi#9700
Summary by Sourcery
This pull request fixes issues with passing Redoc UI parameters by using the JavaScript API and updates the Redoc version to the officially released version 2. It also includes updates to the tests to ensure the changes are correctly implemented.
Summary by CodeRabbit
Bug Fixes
hideDownloadButton
.Improvements
Tests