Skip to content
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

🧹 v3 (Maintenance): Update docs to reflect fiber.Ctx struct to interface change #2880

Merged
merged 2 commits into from Mar 4, 2024

Conversation

grivera64
Copy link
Contributor

@grivera64 grivera64 commented Feb 24, 2024

Description

As v3 introduces a new interface for fiber.Ctx in preference over the current struct *fiber.Ctx in v2, this PR updates the Ctx and related docs to reflect this change.

Related to #2879

Changes Introduced

  • Benchmarks: Describe any performance benchmarks and improvements related to the changes.
  • Documentation Update: Detail the updates made to the documentation and links to the changed files.
    • Update Static.Next() in /docs/api/app.md to use the Ctx interface
    • Update /docs/api/ctx.md to use the Ctx interface
  • Changelog/What's New: Include a summary of the additions for the upcoming release notes.
  • Migration Guide: If necessary, provide a guide or steps for users to migrate their existing code to accommodate these changes.
  • API Alignment with Express: Explain how the changes align with the Express API.
  • API Longevity: Discuss the steps taken to ensure that the new or updated APIs are consistent and not prone to breaking changes.
  • Examples: Provide examples demonstrating the new features or changes in action.

Type of Change

  • Documentation update (changes to documentation)

Checklist

Before you submit your pull request, please make sure you meet these requirements:

  • Followed the inspiration of the Express.js framework for new functionalities, making them similar in usage.
  • 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

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

Summary by CodeRabbit

  • Refactor
    • Enhanced flexibility and decoupling by modifying type declarations and converting a struct to an interface in the codebase.

…ace change

Summary:
- Update `Static.Next()` in `/docs/api/app.md` to use the `Ctx` interface
- Update `/docs/api/ctx.md` to use the `Ctx` interface

Related Issues:
gofiber#2879
@grivera64 grivera64 requested a review from a team as a code owner February 24, 2024 22:57
@grivera64 grivera64 requested review from gaby, sixcolors, ReneWerner87 and efectn and removed request for a team February 24, 2024 22:57
@gaby gaby changed the title 🧹 [v3 Maintenance]: Update docs to reflect fiber.Ctx struct to interface change 🧹 v3 (Maintenance): Update docs to reflect fiber.Ctx struct to interface change Feb 25, 2024
Copy link
Contributor

coderabbitai bot commented Feb 28, 2024

Walkthrough

This modification focuses on enhancing the Go codebase for the fiber package by transitioning the Ctx struct to an interface and adjusting the Next function parameter type within the Static struct from *Ctx to Ctx. This change aims to improve code flexibility and decoupling.

Changes

Files Change Summary
.../app.md, .../ctx.md Updated *Ctx to Ctx following Ctx becoming an interface in the fiber package.

Related issues

🐇✨

In the land of code where the fibers intertwine,
A rabbit hopped forth, making Ctx refine.
From struct to interface, it danced with glee,
For flexibility and decoupling, as easy as can be.
🚀🌟 "Hop, hop, hop," it cheered, "to a cleaner, brighter way!"
In the realm of Go, where the best code does play.
🐇✨

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8c413d0 and db07431.
Files selected for processing (2)
  • docs/api/app.md (1 hunks)
  • docs/api/ctx.md (79 hunks)
Additional comments: 59
docs/api/app.md (1)
  • 96-96: The change from *Ctx to Ctx in the Next function parameter correctly reflects the transition of fiber.Ctx from a struct to an interface. This update is crucial for users to understand the new interface-based approach to fiber.Ctx. It's important to ensure that all examples and code snippets in the documentation are updated to reflect this change for consistency and to prevent confusion.
docs/api/ctx.md (58)
  • 20-23: The method signatures correctly reflect the transition of Ctx from a struct to an interface. However, it's important to ensure that the implementation details and examples provided in the documentation are consistent with this change across the entire framework.
  • 109-109: The method signature for AllParams is correctly updated to use the Ctx interface. This change aligns with the objective of enhancing flexibility and decoupling in the codebase.
  • 133-133: The method signature for App correctly uses the Ctx interface. This is a crucial update, ensuring that the documentation accurately reflects the structural changes introduced in version 3 of the Fiber framework.
  • 151-151: The method signature for Append is correctly updated to use the Ctx interface. This change is consistent with the broader initiative to transition Ctx from a struct to an interface, enhancing the framework's flexibility.
  • 171-171: The method signature for Attachment correctly uses the Ctx interface. This update is part of the documentation effort to accurately represent the changes introduced in version 3 of the Fiber framework.
  • 199-199: The method signature for AutoFormat correctly uses the Ctx interface. This documentation update is essential for developers to understand how to use the AutoFormat method with the new interface-based Ctx.
  • 233-233: The method signature for BaseURL correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, specifically the transition of Ctx to an interface.
  • 251-251: The method signature for Bind correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 271-271: The method signature for BodyRaw correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 291-291: The method signature for Body correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 321-321: The method signature for BodyParser correctly uses the Ctx interface. This update is essential for developers to understand how to use the BodyParser method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 365-365: The method signature for ClearCookie correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 418-418: The method signature for ClientHelloInfo correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 434-434: The method signature for Context correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 446-446: The method signature for Cookie correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 484-484: The method signature for CookieParser correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 515-515: The method signature for Cookies correctly uses the Ctx interface. This update is essential for developers to understand how to use the Cookies method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 539-539: The method signature for Download correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 561-561: The method signature for Format correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 610-610: The method signature for FormFile correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 628-628: The method signature for FormValue correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 653-653: The method signature for Fresh correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 665-665: The method signature for Get correctly uses the Ctx interface. This update is essential for developers to understand how to use the Get method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 685-685: The method signature for GetReqHeaders correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 700-700: The method signature for GetRespHeader correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 720-720: The method signature for GetRespHeaders correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 731-731: The method signature for GetRouteURL correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 756-756: The method signature for Hostname correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 777-777: The method signature for IP correctly uses the Ctx interface. This update is essential for developers to understand how to use the IP method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 801-801: The method signature for IPs correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 827-827: The method signature for Is correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 847-847: The method signature for IsFromLocal correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 869-869: The method signature for JSON correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 921-921: The method signature for JSONP correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 950-950: The method signature for Links correctly uses the Ctx interface. This update is essential for developers to understand how to use the Links method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 975-975: The method signature for Locals correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 1033-1033: The method signature for Location correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 1052-1052: The method signature for Method correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 1071-1071: The method signature for MultipartForm correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 1110-1110: The method signature for Next correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 1135-1135: The method signature for OriginalURL correctly uses the Ctx interface. This update is essential for developers to understand how to use the OriginalURL method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 1160-1160: The method signature for Params correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 1212-1212: The method signature for ParamsInt correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 1232-1232: The method signature for ParamsParser correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 1252-1252: The method signature for Path correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 1273-1273: The method signature for Protocol correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 1291-1291: The method signature for Queries correctly uses the Ctx interface. This update is essential for developers to understand how to use the Queries method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 1359-1359: The method signature for Query correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 1420-1420: The method signature for QueryParser correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 1454-1454: The method signature for Range correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 1479-1479: The method signature for Redirect correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 1514-1514: The method signature for RedirectToRoute correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.
  • 1547-1547: The method signature for RedirectBack correctly uses the Ctx interface. This update is essential for developers to understand how to use the RedirectBack method with the new interface-based Ctx, ensuring a smooth transition to the updated framework.
  • 1569-1569: The method signature for Render correctly uses the Ctx interface. This documentation update is crucial for accurately representing the changes introduced in version 3 of the Fiber framework, specifically the transition of Ctx to an interface.
  • 1577-1577: The method signature for Request correctly uses the Ctx interface. This change ensures that the documentation is up-to-date with the structural changes in the Fiber framework, enhancing the framework's flexibility and maintainability.
  • 1593-1593: The method signature for ReqHeaderParser correctly uses the Ctx interface. This update is crucial for maintaining accurate and clear documentation, reflecting the changes introduced in version 3 of the Fiber framework.
  • 1627-1627: The method signature for Response correctly uses the Ctx interface. This documentation update aligns with the transition of Ctx from a struct to an interface, enhancing the framework's flexibility and maintainability.
  • 1643-1643: The method signature for RestartRouting correctly uses the Ctx interface. This change is part of the broader initiative to update the documentation to reflect the structural changes introduced in version 3 of the Fiber framework.

@ReneWerner87 ReneWerner87 merged commit c5a809f into gofiber:main Mar 4, 2024
1 check passed
@ReneWerner87 ReneWerner87 added the v3 label Mar 4, 2024
@ReneWerner87 ReneWerner87 added this to the v3 milestone Mar 4, 2024
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.

🧹 [v3 Maintenance]: Update docs to reflect fiber.Ctx struct to interface change
4 participants