-
Notifications
You must be signed in to change notification settings - Fork 44
Add support for fiber v3 #112
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request upgrades the Fiber framework from version 2 to version 3. In the main code, the filesystem middleware is replaced with the new static middleware, and the context parameter is now passed by value instead of by pointer. The redirect logic is refactored to utilize a fluent API. Additionally, the import paths in both the main file and the test file are updated to point to Fiber v3, ensuring consistency with the new API. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Fiber
participant StaticHandler
Client->>Fiber: Send HTTP Request
Fiber->>StaticHandler: Serve static file using new FS
Fiber->>Fiber: Call getForwardedPrefix(c) to determine prefix
Fiber->>Client: Issue redirect (Status Moved Permanently) via fluent API
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
🪧 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
🧹 Nitpick comments (1)
swagger.go (1)
10-15
: Update imports for Fiber v3 but clean up commented codeThe imports have been correctly updated to use Fiber v3 and its new middleware structure. However, there's an unused commented import that should be removed.
-"github.com/gofiber/utils/v2" -//"github.com/gofiber/fiber/v3/utils" +"github.com/gofiber/utils/v2"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ 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 context used
🧬 Code Definitions (1)
swagger.go (1)
config.go (1)
Config
(8-186)
🔇 Additional comments (5)
swagger_test.go (1)
8-8
: Import path updated correctly for Fiber v3The import path has been properly updated to use Fiber v3 instead of v2, which aligns with the PR objective of upgrading the framework.
swagger.go (4)
38-38
: FileSystem middleware correctly replaced with Static middlewareThe filesystem middleware has been properly replaced with the static middleware, which is the correct approach for Fiber v3. The configuration has been updated to match the new API requirements.
43-43
: Context parameter correctly updated to pass by valueThe handler function signature has been properly updated to pass the context by value instead of by pointer, which is required for Fiber v3.
74-74
: Redirect logic improved using fluent APIThe redirect logic has been refactored to use Fiber v3's fluent API, which provides a more readable and chainable interface.
81-81
: Function signature updated for context parameterThe
getForwardedPrefix
function signature has been correctly updated to accept context by value instead of by pointer, maintaining consistency with Fiber v3 requirements.
swagger.go
Outdated
fmt.Println(fs, swaggerFiles.FS) | ||
|
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.
🛠️ Refactor suggestion
Remove debug print statement
This print statement was likely added for debugging purposes during development and should be removed before merging to production.
-fmt.Println(fs, swaggerFiles.FS)
📝 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.
fmt.Println(fs, swaggerFiles.FS) |
I want using swagger v3 @gaby help me check PR |
We will upgrade these once v3 is ready |
Summary by CodeRabbit
Chores
Refactor