Skip to content

feat(docs): update docs removing SetUserContext and UserContext#1722

Merged
ReneWerner87 merged 1 commit into
gofiber:mainfrom
xsadia:feat/update-docs-remove-UserContext-and-SetUserContext
Feb 28, 2026
Merged

feat(docs): update docs removing SetUserContext and UserContext#1722
ReneWerner87 merged 1 commit into
gofiber:mainfrom
xsadia:feat/update-docs-remove-UserContext-and-SetUserContext

Conversation

@xsadia
Copy link
Copy Markdown
Contributor

@xsadia xsadia commented Feb 28, 2026

Description

Updates the gofiber/contrib/v3/otel and gofiber/contrib/v3/zap docs to reflect the context API change introduced in Fiber v3.

Since fiber.Ctx now directly satisfies the context.Context interface, SetUserContext/UserContext have been removed in favor of SetContext/Context.

Key changes:

  • Replaced c.UserContext()c.Context()
  • Replaced c.SetUserContext(ctx)c.SetContext(ctx)

Summary by CodeRabbit

  • Documentation
    • Updated code examples in OpenTelemetry and Zap integration guides to reflect the latest context handling practices in the framework.

@xsadia xsadia requested a review from a team as a code owner February 28, 2026 06:56
@xsadia xsadia requested review from ReneWerner87, efectn, gaby and sixcolors and removed request for a team February 28, 2026 06:56
@ReneWerner87 ReneWerner87 added ✏️ Feature New feature or request 📒 Documentation Improvements or additions to documentation labels Feb 28, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 updates the documentation examples for the otel and zap Fiber v3 contrib modules. The changes align the examples with the new context handling in Fiber v3, where fiber.Ctx directly implements context.Context, thus deprecating the UserContext and SetUserContext methods in favor of Context and SetContext.

Highlights

  • Documentation Update: The documentation for gofiber/contrib/v3/otel and gofiber/contrib/v3/zap has been updated to reflect changes in the Fiber v3 context API.
  • Context API Change: The methods SetUserContext and UserContext have been removed in Fiber v3, as fiber.Ctx now directly satisfies the context.Context interface. The documentation examples now use SetContext and Context.
Changelog
  • v3/otel/README.md
    • Replaced c.UserContext() with c.Context() in the /users/:id example route.
  • v3/zap/README.md
    • Replaced c.UserContext() with c.Context() and c.SetUserContext(ctx) with c.SetContext(ctx) in the middleware example.
    • Updated the / route example to use log.WithContext(c.Context()) instead of log.WithContext(c.UserContext()).
Activity
  • No human activity has been recorded on this pull request yet.
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.

Copy link
Copy Markdown
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 updates the documentation in v3/otel/README.md and v3/zap/README.md to align with the context API changes in Fiber v3. The changes correctly replace the deprecated c.UserContext() and c.SetUserContext() with c.Context() and c.SetContext() respectively in the code examples. The modifications are accurate and successfully reflect the intended API update.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 28, 2026

Walkthrough

This PR updates documentation examples in two README files to use the newer Fiber context API, replacing deprecated c.UserContext()/SetUserContext() methods with c.Context()/SetContext() equivalents across middleware and handler code examples.

Changes

Cohort / File(s) Summary
Fiber Context API Migration
v3/otel/README.md, v3/zap/README.md
Documentation examples updated to use c.Context()/SetContext() instead of c.UserContext()/SetUserContext() for accessing and setting request-scoped context values in middleware and handler examples. Also updates log.WithContext() usage to reference the new context API.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Old contexts fade, new paths light the way,
SetUserContext's time has had its day,
c.Context() hops through middleware clean,
The cleanest context flow we've ever seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating documentation to remove deprecated SetUserContext and UserContext methods, which is exactly what both README files reflect.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@ReneWerner87 ReneWerner87 removed the ✏️ Feature New feature or request label Feb 28, 2026
@ReneWerner87 ReneWerner87 merged commit e9f9bd2 into gofiber:main Feb 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📒 Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants