Skip to content

Fix swagger package migration targets#246

Merged
ReneWerner87 merged 1 commit into
masterfrom
codex/2025-12-01-12-24-09
Dec 1, 2025
Merged

Fix swagger package migration targets#246
ReneWerner87 merged 1 commit into
masterfrom
codex/2025-12-01-12-24-09

Conversation

@ReneWerner87
Copy link
Copy Markdown
Member

@ReneWerner87 ReneWerner87 commented Dec 1, 2025

Summary

  • update swagger migration to map contrib/swagger to contrib/v3/swaggerui and github.com/gofiber/swagger to contrib/v3/swaggo
  • ensure go.mod updates fetch the correct contrib module versions
  • adjust swagger migration tests to reflect the new import targets

Testing

  • make lint
  • make test

Codex Task

Summary by CodeRabbit

  • Bug Fixes
    • Corrected Swagger dependency module path mapping during migrations to ensure proper package resolution and import rewriting.

✏️ Tip: You can customize this high-level summary in your review settings.

@ReneWerner87 ReneWerner87 requested a review from a team as a code owner December 1, 2025 12:24
@ReneWerner87 ReneWerner87 requested review from efectn, gaby and sixcolors and removed request for a team December 1, 2025 12:24
@github-actions github-actions Bot added the ☢️ Bug Something isn't working label Dec 1, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ReneWerner87, 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 an issue with the migration logic for Swagger-related packages, ensuring that the correct v3 contrib modules are targeted when updating dependencies. It rectifies the mapping between older Swagger imports and their modern counterparts, along with corresponding adjustments to go.mod updates and test cases, to facilitate a smooth transition for users.

Highlights

  • Swagger Migration Targets: Corrected the mapping of old Swagger package imports to their new v3 contrib module targets. contrib/swagger now maps to contrib/v3/swaggerui, and github.com/gofiber/swagger now maps to contrib/v3/swaggo.
  • Go Module Updates: Ensured that the go.mod file updates correctly fetch the appropriate contrib module versions based on the revised Swagger package mappings.
  • Test Adjustments: Updated the migration tests to accurately reflect the new import targets and module versions for Swagger-related packages.
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 correctly fixes the swagger package migration targets by swapping the destinations for contrib/swagger and gofiber/swagger. The logic in swagger_packages.go is now correct, and the corresponding tests in swagger_packages_test.go have been updated to reflect these changes. The fix appears solid. I've added a couple of suggestions in the test file to improve maintainability by replacing magic strings with constants.

Comment thread cmd/internal/migrations/v3/swagger_packages_test.go
Comment thread cmd/internal/migrations/v3/swagger_packages_test.go
@ReneWerner87 ReneWerner87 merged commit 036ded6 into master Dec 1, 2025
14 of 15 checks passed
@ReneWerner87 ReneWerner87 deleted the codex/2025-12-01-12-24-09 branch December 1, 2025 12:27
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 1, 2025

Walkthrough

This pull request swaps the target module paths for Swagger dependencies in a migration tool, reversing which contrib module maps to swaggerui versus swaggo. The corresponding test file is updated to reflect these swapped mappings and their expected assertions.

Changes

Cohort / File(s) Summary
Swagger Migration Logic
cmd/internal/migrations/v3/swagger_packages.go
Reversed target module paths: contribSwaggerNew now points to swaggerui (was swaggo), fiberSwaggerNew now points to swaggo (was swaggerui). Reordered dependency checks so needsSwaggerUI derives from contrib paths and needsSwaggo derives from fiber paths. Updated module update calls and import rewriting logic to use the new target paths.
Swagger Migration Tests
cmd/internal/migrations/v3/swagger_packages_test.go
Updated test assertions and version fetcher mappings to reflect swapped module targets. FiberSwagger scenario now expects swaggo instead of swaggerui. Test expectations for go.mod replace directives and generated content align with the reversed module mappings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Key areas requiring attention:
    • Verify the correctness of the swapped mappings between fiber and contrib swagger modules (understand the intent behind the swap)
    • Cross-check that all references in both the logic and tests are consistently updated
    • Ensure the reordered dependency checks maintain the correct logic flow
    • Validate test assertions match the new expected behavior for both FiberSwagger and ContribSwagger scenarios

Possibly related PRs

Suggested labels

☢️ Bug

Suggested reviewers

  • gaby
  • sixcolors
  • efectn

Poem

🐰 A swap in the swagger, left becomes right,
Modules reshuffled to set things aright,
Fiber and contrib now dance in new places,
With tests catching up in their mirrored traces!
The imports now journey down different ways,
Yet bring the same swagger to fiber's bright days! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix swagger package migration targets' clearly and specifically describes the main change—correcting the mapping of swagger package dependencies in the migration logic.
Description check ✅ Passed The description provides a clear summary of changes and testing steps, though it lacks detail on the underlying problem being solved as outlined in the template.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/2025-12-01-12-24-09

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d94a903 and 1c8af9e.

📒 Files selected for processing (2)
  • cmd/internal/migrations/v3/swagger_packages.go (2 hunks)
  • cmd/internal/migrations/v3/swagger_packages_test.go (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build (1.25.x, macos-latest)
  • GitHub Check: Build (1.25.x, ubuntu-latest)
  • GitHub Check: Build (1.25.x, windows-latest)
  • GitHub Check: Build (1.25.x, macos-13)
🔇 Additional comments (4)
cmd/internal/migrations/v3/swagger_packages.go (2)

84-109: LGTM - logic correctly updated to match swapped module paths.

The migration logic has been properly adjusted:

  • needsSwaggerUI correctly checks for contrib swagger packages (old/new)
  • needsSwaggo correctly checks for fiber swagger packages (old/new)
  • Version fetching and module updates use the appropriate version variables for each package

The implementation is internally consistent with the swapped constant definitions.


24-26: No action required. The swagger package migration paths are correct and not swapped.

The paths map appropriately to two distinct packages:

  • github.com/gofiber/contrib/swaggergithub.com/gofiber/contrib/v3/swaggerui (serves pre-generated OpenAPI/Swagger JSON with embedded UI)
  • github.com/gofiber/swaggergithub.com/gofiber/contrib/v3/swaggo (Swagger doc generator)

The migration logic correctly treats these as separate migration paths.

cmd/internal/migrations/v3/swagger_packages_test.go (2)

22-64: LGTM - test correctly validates swapped migration targets.

The test properly validates that contrib/swagger now migrates to contrib/v3/swaggerui:

  • Version fetcher returns v3.0.1 for swaggerUIModule
  • Import assertion expects swaggerui path
  • go.mod assertions expect swaggerui module and replace directive

This aligns with the implementation changes.


66-110: LGTM - FiberSwagger test correctly validates swapped migration targets.

The test properly validates that gofiber/swagger now migrates to contrib/v3/swaggo:

  • Version fetcher returns v3.2.0 for swaggoModule
  • Import assertion expects swaggo path
  • go.mod assertion expects swaggo module with correct version

This aligns with the implementation changes.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant