📒 docs: Improve wording and fix typos#3713
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughDocumentation wording and example adjustments across multiple guides: Advanced Format (MsgPack/CBOR heading, Accept header wording, example variable fix), error-handling clarifications, performance page library additions and example tweaks, grouping terminology and phrasing updates, templates “bound” wording, and intro phrasing refinements. No code or API changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Summary of Changes
Hello @gaby, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request focuses on enhancing the clarity, accuracy, and consistency of the Fiber framework's documentation. It includes significant wording improvements, typo fixes, and refined explanations across various guide sections, such as advanced data formats, error handling, templating, JSON encoding, and routing groups, aiming to provide clearer guidance for users.
Highlights
- Documentation Clarity: Improved overall wording and fixed typos across multiple guide documents for better readability and understanding.
- Advanced Formats: Clarified explanations and corrected examples for MessagePack (MsgPack) and CBOR usage.
- Error Handling: Refined descriptions for catching errors and using custom error handlers in Fiber applications.
- JSON Encoder/Decoder: Updated advice on custom JSON encoders and corrected a code comment in the example.
- Grouping and Routing: Enhanced explanations for route grouping behavior and basic routing concepts.
- Templating: Standardized terminology from "binded data" to "bound data" for template rendering.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request provides a series of documentation improvements, including fixing typos, correcting grammatical errors, and rephrasing content for better clarity and conciseness. The changes span multiple guide documents, enhancing their readability and correctness. A notable fix includes correcting a variable name in a code example, which improves the example's accuracy. Overall, these are excellent changes that polish the documentation.
There was a problem hiding this comment.
Pull Request Overview
This PR improves the clarity and accuracy of Fiber's documentation by refining language, fixing typos, and enhancing technical explanations across multiple guide files.
- Polished wording in introduction and routing sections for better readability
- Fixed grammatical errors and improved technical terminology consistency
- Corrected code examples and enhanced explanations of advanced features
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/intro.md | Streamlined welcome message and improved explanations of zero allocation and basic routing concepts |
| docs/guide/templates.md | Fixed grammar issues with "binded" to "bound" and clarified template rendering explanations |
| docs/guide/grouping.md | Enhanced group functionality explanations and improved clarity of handler behavior |
| docs/guide/faster-fiber.md | Fixed syntax error in code comment and refined JSON encoder guidance |
| docs/guide/error-handling.md | Streamlined error handling explanations and improved custom error handler descriptions |
| docs/guide/advance-format.md | Corrected title spelling, fixed variable name in example, and improved CBOR/MsgPack explanations |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/guide/templates.md (1)
127-133: Example compiles: missing closing parenthesis in AddFunc example.The function literal closes with “}” but the
AddFunccall needs “})”. Copy-paste will fail as-is.Apply this diff:
-engine.AddFunc("ToUpper", func(s string) string { - return strings.ToUpper(s) -} +engine.AddFunc("ToUpper", func(s string) string { + return strings.ToUpper(s) +})docs/guide/error-handling.md (1)
58-66: Fix unreachable code in example; show alternatives without breaking compilation.Two return statements in sequence make the second one unreachable if copied verbatim. Present one as a commented alternative.
app.Get("/", func(c fiber.Ctx) error { - // 503 Service Unavailable - return fiber.ErrServiceUnavailable - - // 503 On vacation! - return fiber.NewError(fiber.StatusServiceUnavailable, "On vacation!") + // Option 1: 503 Service Unavailable (predefined) + // return fiber.ErrServiceUnavailable + + // Option 2: 503 with custom message + return fiber.NewError(fiber.StatusServiceUnavailable, "On vacation!") })
🧹 Nitpick comments (6)
docs/guide/templates.md (1)
55-57: Terminology consistency: “bound data” vs. “data to bind.”Line 55 uses “bound data” while Line 61 says “data to bind.” Prefer one term across the page (I’d keep “bound data”).
Apply this diff to Line 61:
-The `Render` method powers the [**ctx.Render()**](../api/ctx.md#render) function, which accepts a template name and data to bind. +The `Render` method powers the [**ctx.Render()**](../api/ctx.md#render) function, which accepts a template name and bound data.docs/guide/faster-fiber.md (1)
11-15: Clarify drop-in vs. non drop-in libraries.
segmentio/encoding/jsoncan act as a drop-in (sameMarshal/Unmarshalsignatures under ajsonimport alias).minio/simdjson-gois primarily a high-performance parser and not a drop-in replacement forencoding/jsonencoders/decoders; it won’t plug intoJSONEncoder/JSONDecoderwithout adapters.A short note next to each bullet would prevent confusion.
Apply this diff:
-- [segmentio/encoding](https://github.com/segmentio/encoding) -- [minio/simdjson-go](https://github.com/minio/simdjson-go) +- [segmentio/encoding](https://github.com/segmentio/encoding) — Drop-in `json.Marshal`/`json.Unmarshal` under `github.com/segmentio/encoding/json`. +- [minio/simdjson-go](https://github.com/minio/simdjson-go) — SIMD-accelerated JSON parser (not a drop-in encoder/decoder).docs/intro.md (1)
132-166: Ports vary across examples (3000 vs. 8080).Consider standardizing on one port across examples for consistency (e.g., 3000).
docs/guide/grouping.md (1)
8-9: Tone: “identical to Express.js” is stronger than necessary.Suggest softening to “similar to Express.js” to avoid implying perfect parity in edge cases.
Apply this diff:
-In general, group functionality in Fiber behaves like Express.js. Groups are declared virtually, and all routes defined within a group are flattened into a single list with a prefix and processed in the order declared. This makes group behavior in Fiber identical to Express.js. +In general, group functionality in Fiber is similar to Express.js. Groups are declared virtually, and all routes defined within a group are flattened into a single list with a prefix and processed in the order declared.docs/guide/error-handling.md (2)
16-16: Tighten wording: errors are returned from handlers to Fiber’s error handler, not “to the handler function”.The current phrasing can be misread. This edit is clearer and accurate.
-Ensure that Fiber catches all errors from route handlers and middleware by returning them to the handler function for processing. +Return errors from your handlers and middleware so Fiber’s error handler can process them.
96-96: Add a short note on avoiding sensitive error leakage; optionally include a JSON error example.Since many users copy docs verbatim, a one-liner reminding to avoid returning internal error strings directly (and to prefer structured JSON for APIs) is valuable.
-In most cases, the default error handler is sufficient. However, a custom handler is useful when you need to capture different error types and respond accordingly—for example, sending notification emails or logging to a centralized system. You can also send custom responses to the client, such as an error page or a JSON message. +In most cases, the default error handler is sufficient. However, a custom handler is useful when you need to capture different error types and respond accordingly—for example, sending notification emails or logging to a centralized system. You can also send custom responses to the client (HTML pages or structured JSON). For production APIs, avoid leaking internal error details in responses; log them server‑side and return sanitized messages to clients.Optional example (no change required in this PR):
// JSON-oriented error handler (sanitizes messages) app := fiber.New(fiber.Config{ ErrorHandler: func(c fiber.Ctx, err error) error { code := fiber.StatusInternalServerError var fe *fiber.Error if errors.As(err, &fe) { code = fe.Code } // Log full error internally // log.Printf("request_id=%s err=%v", c.GetRespHeader("X-Request-ID"), err) // Return a minimal, structured response type apiError struct { Error string `json:"error"` Code int `json:"code"` TraceID string `json:"trace_id,omitempty"` } payload := apiError{ Error: http.StatusText(code), Code: code, // TraceID: c.GetRespHeader("X-Request-ID"), // if you set one } c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSONCharsetUTF8) return c.Status(code).JSON(payload) }, })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
docs/guide/advance-format.md(3 hunks)docs/guide/error-handling.md(3 hunks)docs/guide/faster-fiber.md(2 hunks)docs/guide/grouping.md(3 hunks)docs/guide/templates.md(1 hunks)docs/intro.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Review and update the contents of the
docsfolder if necessary when modifying code
Files:
docs/guide/templates.mddocs/guide/grouping.mddocs/guide/error-handling.mddocs/guide/faster-fiber.mddocs/guide/advance-format.mddocs/intro.md
🧠 Learnings (7)
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
Applied to files:
docs/guide/error-handling.mddocs/guide/faster-fiber.mddocs/intro.md
📚 Learning: 2024-09-25T16:18:34.719Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/config.go:122-122
Timestamp: 2024-09-25T16:18:34.719Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.
Applied to files:
docs/guide/error-handling.md
📚 Learning: 2025-07-08T13:41:20.627Z
Learnt from: ksw2000
PR: gofiber/fiber#0
File: :0-0
Timestamp: 2025-07-08T13:41:20.627Z
Learning: ksw2000 suggests implementing a pluggable encoder/decoder registry system in Fiber instead of hardcoding all encoders in app.config. This would solve dependency management issues by allowing users to opt-in only to the formats they need, keeping JSON and XML as defaults while making CBOR and MsgPack explicit registrations.
Applied to files:
docs/guide/faster-fiber.mddocs/guide/advance-format.md
📚 Learning: 2024-12-01T10:28:36.011Z
Learnt from: ReneWerner87
PR: gofiber/fiber#0
File: :0-0
Timestamp: 2024-12-01T10:28:36.011Z
Learning: Fiber currently supports square bracket notation in form data with 'application/x-www-form-urlencoded' content type, but this feature is not available for multipart form data. The implementation for form-urlencoded is in ctx.go (BodyParser method), while multipart form data handling needs enhancement to support this feature.
Applied to files:
docs/guide/advance-format.md
📚 Learning: 2025-05-13T00:19:16.407Z
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
Applied to files:
docs/intro.md
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Applied to files:
docs/intro.md
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
Applied to files:
docs/intro.md
🔇 Additional comments (17)
docs/guide/templates.md (1)
66-66: Good clarification on “bound” wording.Replacing “binded” with “bound” fixes the grammar and reads cleanly.
docs/guide/faster-fiber.md (2)
28-28: LGTM on comment style.Switching to
// ...matches Go conventions inside code blocks.
9-9: Verify the version whereencoding/jsonbecame the default
The note in docs/guide/faster-fiber.md (line 9) states “Since Fiber v2.32.0…”. Please double-check Fiber’s release history or source to confirm the exact version that re-adoptedencoding/jsonas the default JSON implementation. If this is incorrect, update the version to the accurate one.
- docs/guide/faster-fiber.md: line 9
docs/guide/advance-format.md (3)
3-3: Title fix reads correctly.“Advanced Format” is the right phrasing and improves discoverability.
58-60: Example variable fix is correct.Returning
usermatches the value bound above.
58-59: No changes required: Content-Type isapplication/vnd.msgpack.The code’s default for
Ctx.MsgPack()is indeedapplication/vnd.msgpack(seeconstants.go:31whereMIMEApplicationMsgPack = "application/vnd.msgpack", andDefaultRes.MsgPackuses this constant when no custom type is provided). Tests inctx_test.goalso assert this value. The documentation correctly reflects this.docs/intro.md (7)
7-7: Welcome sentence reads better.Nice, concise improvement.
19-23: Instruction reads clearer.“Install Fiber using the go get command” is more direct.
27-36: Good balance of “should” vs. “must not.”This keeps the performance guidance firm without sounding overly prescriptive.
78-94: Phrasing improvement acknowledged.“Simplest Fiber application” is clearer phrasing.
104-119: Routing description is tighter.The reworded sentence is accurate and easier to scan.
11-11: Update placeholder with official Fiber v3 release datePlease replace the placeholder “Month xx, 202x” with the actual public release date of Fiber v3 (as documented in the official GitHub releases or changelog) before merging.
• File: docs/intro.md
• Line: 11
• Current text:
These docs are for **Fiber v3**, which was released on **Month xx, 202x**.
• Action: swap out “Month xx, 202x” for the real release date (e.g., “June 10, 2025”).Please verify the exact date from your authoritative source (e.g., the Fiber GitHub Releases page) and update accordingly.
17-17: Verify Go version requirementI wasn’t able to locate any
go.modin the repository to confirm the minimum Go version. Please ensure the docs align with the actual requirement declared in your module or CI configuration:• Confirm where your
go.modlives and check itsgo <version>directive.
• If you specify the Go version in CI (e.g. GitHub Actions workflows), make sure docs/intro.md matches that.
• Update line 17 of docs/intro.md (“Version1.25or higher is required.”) to reflect the true minimum version.docs/guide/grouping.md (4)
13-14: Good simplification.“Path prefixes to organize related routes” is clearer and accurate.
33-34: LGTM on phrasing.“Include an optional handler” reads better.
54-55: Caution note reads cleaner.The 404 guidance is accurate and concise.
59-73: Accurate requirement to call Next.Essential detail for group middleware; good clarification.
Summary