-
Notifications
You must be signed in to change notification settings - Fork 32
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
Update gofiber compability from v2 to v3 #103
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes in this pull request involve upgrading the Changes
Possibly related PRs
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 (
|
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: 1
🧹 Outside diff range and nitpick comments (2)
swagger.go (1)
38-38
: LGTM: Handler signature updated per v3 requirementsThe handler signature has been correctly updated to use non-pointer
fiber.Ctx
parameter as required by fiber v3.Consider adding a comment to document this breaking change for better visibility to package users.
swagger_test.go (1)
8-8
: Consider adding tests for v3-specific featuresWhile the import has been correctly updated to fiber v3, consider adding test cases to verify:
- Error handling with non-pointer context
- Static middleware functionality
- New redirection behavior
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
📒 Files selected for processing (2)
swagger.go
(3 hunks)swagger_test.go
(1 hunks)
🔇 Additional comments (2)
swagger.go (2)
69-69
: LGTM: Redirection code updated to v3 syntax
The redirection code has been updated to use the new method chaining syntax (Redirect().Status().To()
), which improves readability and follows fiber v3 standards.
10-12
: Verify utils package compatibility with fiber v3
While the fiber package has been correctly upgraded to v3, the utils package remains at v2. This version mismatch might cause compatibility issues.
✅ Verification successful
Let me try a different approach to verify the compatibility between fiber v3 and utils package.
Utils package version is compatible with Fiber v3
The utils package version v2.0.0-beta.7
is actually aligned with Fiber v3.0.0-beta.3 as shown in the go.mod file. Both packages are using beta versions that are meant to work together, and the version difference (v2 vs v3) is not a compatibility concern in this case.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if fiber v3 has any compatibility requirements for utils package
gh api graphql -f query='
{
repository(owner: "gofiber", name: "fiber") {
object(expression: "v3") {
... on Commit {
file(path: "go.mod") {
object {
... on Blob {
text
}
}
}
}
}
}
}'
Length of output: 322
Script:
#!/bin/bash
# Check the current go.mod file to see utils package requirements
cat go.mod
# Search for utils package usage patterns in the codebase
rg "github.com/gofiber/utils" -A 2 -B 2
Length of output: 2409
return static.New("/", static.Config{ | ||
FS: swaggerFiles.FS, | ||
Browse: true, | ||
})(c) |
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.
Security: Review static middleware configuration
The static middleware is configured with Browse: true
, which could potentially expose sensitive files. Consider if directory browsing is necessary for your use case.
return static.New("/", static.Config{
FS: swaggerFiles.FS,
- Browse: true,
+ Browse: false,
})(c)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
return static.New("/", static.Config{ | |
FS: swaggerFiles.FS, | |
Browse: true, | |
})(c) | |
return static.New("/", static.Config{ | |
FS: swaggerFiles.FS, | |
Browse: false, | |
})(c) |
Thx for your work |
Here are the changes:
*fiber.Ctx
->fiber.Ctx
)Might be breaking changes since v3 only supports Go 1.23+ (Specified Here)
Summary by CodeRabbit
New Features
Bug Fixes
Documentation