-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 bug: make Render bind parameter type any again #3270
Conversation
WalkthroughThe pull request introduces a modification to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3270 +/- ##
==========================================
- Coverage 84.04% 84.02% -0.03%
==========================================
Files 116 116
Lines 11522 11522
==========================================
- Hits 9684 9681 -3
- Misses 1407 1409 +2
- Partials 431 432 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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
🧹 Nitpick comments (1)
ctx_interface_gen.go (1)
15-15
: Consider fixing the grammar in the docstring.In the sentence "Ctx represents the Context which hold the HTTP request and response," consider using "holds" instead of "hold" to maintain grammatical consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
ctx.go
(1 hunks)ctx_interface_gen.go
(2 hunks)docs/api/ctx.md
(1 hunks)
🔇 Additional comments (3)
ctx_interface_gen.go (1)
265-265
: Reversion to an untyped parameter.Changing the parameter type from
Map
toany
aligns with the PR objective to allow more flexibility for template binding. However, losing type safety may introduce potential runtime errors if the object bound is not suitable for rendering. Ensure that any checks or validations are handled within the rendering logic as needed.ctx.go (1)
1372-1372
: Revert toany
for broader binding support.This change fulfills the intent of reverting the
Render
method signature to acceptany
instead ofMap
. It addresses use cases where struct binding is needed. Consider adding validation or type checks within the method to prevent runtime panics if unexpected binding data is passed.docs/api/ctx.md (1)
1509-1509
: Documentation alignment with reverted signature.Updating the
Render
method signature in the docs fromMap
toany
accurately reflects the revert, ensuring consistency between code and documentation.
Description
bind parameter of Render method has been converted from
any
tomap[string]any
by me a long time ago to keep the parameter type-safe. However this change breaks some usecases such as using bind as struct etc. Therefore, let's revert the change.Example usecase that
html/template
supports struct types as binding data: https://pkg.go.dev/html/template#example-package,Fixes #3219
Changes introduced
Type of change
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/
directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md