Skip to content

Conversation

@omer-cengel
Copy link
Contributor

Description

This PR fixes the incorrect custom context example in the whats_new.md documentation. The example was using fiber.Ctx and fiber.NewCtx() which are incorrect - the proper types are fiber.DefaultCtx and fiber.NewDefaultCtx() for embedding in custom context structs.

Fixes #3948

Changes introduced

  • Benchmarks: Not applicable
  • Documentation Update: Corrected the custom context example in /docs/whats_new.md to use the proper types (fiber.DefaultCtx, fiber.CustomCtx, and fiber.NewDefaultCtx)
  • Changelog/What's New: Not applicable
  • Migration Guide: Not applicable
  • API Alignment with Express: Not applicable
  • API Longevity: Not applicable
  • Examples: Fixed the example code to demonstrate the correct usage of custom context

Type of change

  • Documentation update (changes to documentation)

Checklist

  • Conducted a self-review of the code and provided comments for complex or critical parts.
  • Updated the documentation in the /docs/ directory for Fiber's documentation.
  • Added or updated unit tests to validate the effectiveness of the changes or new features.
  • Ensured that new and existing unit tests pass locally with the changes.
  • Verified that any new dependencies are essential and have been agreed upon by the maintainers/community.
  • Aimed for optimal performance with minimal allocations in the new code.
  • Provided benchmarks for the new code to analyze and improve upon.

Commit formatting

Used 📚 Doc: prefix for documentation changes

Correct the custom context example to use fiber.DefaultCtx and fiber.NewDefaultCtx instead of fiber.Ctx and fiber.NewCtx
@omer-cengel omer-cengel requested a review from a team as a code owner December 16, 2025 20:48
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Updated documentation examples to use fiber.DefaultCtx embedding in the CustomCtx struct and adjusted the NewWithCustomCtx factory callback to return fiber.CustomCtx; also a small heading-level formatting change in a routing doc.

Changes

Cohort / File(s) Summary
Whats new docs
docs/whats_new.md
Replaced CustomCtx embedding from fiber.Ctx to fiber.DefaultCtx; changed example NewWithCustomCtx callback to return fiber.CustomCtx; updated initialization from Ctx: *fiber.NewCtx(app) to DefaultCtx: *fiber.NewDefaultCtx(app).
Routing docs (formatting)
docs/partials/routing/handler.md
Adjusted heading level from # Use to ## Use (formatting-only change).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on the docs/whats_new.md code example for accurate types and initialization.
  • Verify the handler.md heading change doesn't break included anchors or rendered TOC.

Possibly related PRs

Suggested reviewers

  • gaby
  • sixcolors
  • efectn

Poem

🐇 I hopped through docs to mend the mix,
Swapped Ctx for DefaultCtx — a neat little fix.
CustomCtx now stands tall and true,
Examples tidy, readers too.
🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: Fix example in whats_new.md' clearly and specifically describes the main change—fixing a documentation example—and accurately reflects the changeset.
Description check ✅ Passed The description provides clear context, references the linked issue, documents changes with appropriate checkboxes, specifies the type of change, and includes a relevant checklist.
Linked Issues check ✅ Passed The PR successfully addresses issue #3948 by correcting the custom context example to use fiber.CustomCtx and fiber.DefaultCtx instead of incorrect types.
Out of Scope Changes check ✅ Passed Besides the main documentation fix, there is a minor formatting change to a heading in routing/handler.md, which appears to be a tangential documentation improvement rather than out-of-scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 293d8af and 30ea6c7.

📒 Files selected for processing (1)
  • docs/partials/routing/handler.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/partials/routing/handler.md

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @omer-cengel, 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 addresses and rectifies an inaccuracy within the whats_new.md documentation. Specifically, it corrects the example demonstrating custom context usage in Fiber, ensuring that the provided code snippets utilize the proper types (fiber.DefaultCtx and fiber.NewDefaultCtx()) for embedding within custom context structs. This enhancement improves the reliability and clarity of the documentation, guiding users toward correct implementation patterns.

Highlights

  • Documentation Correction: Updated the custom context example in whats_new.md to use the correct fiber.DefaultCtx and fiber.NewDefaultCtx() types, replacing the previously incorrect fiber.Ctx and fiber.NewCtx() usages.
  • Example Code Fix: Modified the fiber.NewWithCustomCtx function's return type in the example from fiber.Ctx to fiber.CustomCtx, ensuring the example accurately reflects custom context implementation.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

@ReneWerner87 ReneWerner87 added this to v3 Dec 16, 2025
@ReneWerner87 ReneWerner87 added this to the v3 milestone Dec 16, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an example for using custom contexts in the whats_new.md documentation. The changes replace incorrect types and function calls with the correct ones. My review includes a suggestion to further improve the example by making it more complete and demonstrating the usage of the custom context, which would enhance its value for developers.

@gaby gaby changed the title 📚 Doc: Fix custom context example in whats_new.md 📚 docs: Fix custom context example in whats_new.md Dec 17, 2025
@gaby gaby changed the title 📚 docs: Fix custom context example in whats_new.md 📚 docs: Fix example in whats_new.md Dec 17, 2025
@gaby
Copy link
Member

gaby commented Dec 17, 2025

@omer-cengel Markdownlint failure is unrelated, but can you fix that here too. Thanks!

@gaby gaby merged commit 5d0c960 into gofiber:main Dec 17, 2025
4 checks passed
@welcome
Copy link

welcome bot commented Dec 17, 2025

Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@github-project-automation github-project-automation bot moved this to Done in v3 Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🧹 [Maintenance]: Example seems to be wrong

3 participants