-
-
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
📚 Doc: Optimize the menu item text #3267
Conversation
WalkthroughThe pull request focuses on updating the documentation for Fiber's session middleware, detailing significant changes from version 2 to version 3. The documentation now provides a more comprehensive explanation of session management, highlighting the middleware's flexibility with multi-database storage support. Key modifications include changes to function signatures, session lifecycle management, and timeout handling, with a new migration guide to help developers transition between versions. Changes
Sequence DiagramsequenceDiagram
participant App
participant SessionMiddleware
participant Store
participant Session
App->>SessionMiddleware: Configure with New()
SessionMiddleware-->>App: Returns (Handler, *Store)
App->>SessionMiddleware: Use middleware
SessionMiddleware->>Store: Get/Create Session
Store-->>SessionMiddleware: Return Session
SessionMiddleware->>Session: Manage Session Lifecycle
Session->>Session: Apply Timeouts
Session->>Store: Release Session
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 (
|
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.
👍 LGTM
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 (4)
docs/middleware/session.md (4)
Line range hint
47-57
: Consider adding a breaking changes warning.While the migration guide is comprehensive, consider adding a prominent warning note at the beginning of the migration section to alert users about potential breaking changes, especially regarding the session lifecycle management and expiration handling changes.
Add this note before the migration details:
## Migration Guide +:::warning +**Breaking Changes**: Version 3 introduces significant changes to session management that may require updates to your existing code. Please review the migration guide carefully before upgrading. +::: ### v2 to v3
Line range hint
271-284
: Enhance error handling in examples.While the example is clear, it could benefit from more robust error handling practices.
Consider updating the example to include more comprehensive error handling:
app.Get("/", func(c fiber.Ctx) error { sess := session.FromContext(c) if sess == nil { - return c.SendStatus(fiber.StatusInternalServerError) + return fmt.Errorf("failed to get session from context: %w", fiber.ErrInternalServerError) } name, ok := sess.Get("name").(string) if !ok { - return c.SendString("Welcome anonymous user!") + // Log the type assertion failure if needed + return c.Status(fiber.StatusOK).SendString("Welcome anonymous user!") } - return c.SendString("Welcome " + name) + return c.Status(fiber.StatusOK).SendString("Welcome " + name) })
Line range hint
379-404
: Add note about custom type serialization.Consider adding information about serialization implications when using custom types.
Add this note after the custom types example:
} +:::note +**Serialization Notice**: Custom types must be serializable. Ensure your custom types: +- Don't contain unexported fields (they won't be serialized) +- Don't contain channels, functions, or complex types that can't be serialized +- Implement proper marshaling/unmarshaling if needed +:::
Line range hint
406-434
: Add security recommendations for configuration.Consider adding security best practices for production deployments.
Add this note before the configuration table:
+:::warning +**Security Recommendations for Production**: +- Set `CookieSecure: true` when using HTTPS +- Keep `CookieHTTPOnly: true` to prevent XSS attacks +- Consider using `CookieSameSite: "Strict"` for enhanced security +- Use a secure storage implementation instead of the default memory storage +::: | Property | Type | Description | Default |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/middleware/session.md
(1 hunks)
🔇 Additional comments (1)
docs/middleware/session.md (1)
5-8
: LGTM! Clear and concise title with informative introduction.
The simplified title and restructured introduction effectively communicate the middleware's purpose while maintaining clarity. The emphasis on backward compatibility while recommending the new approach is particularly helpful for users.
Description
In the documentation(next version), the menu item text of the middleware session is displayed abnormally, I view to fix this issue.
Changes introduced
I checked the docs(v2), and realized that the current title was actually the first sentence of the text at the time. Then I checked the docs(next) and realized that there was already a similar description in the text, so I just cut it down to what a title should look like.
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