Codegen: add fiber v3 support - #1937
Conversation
Important change: the GenerateImports now accepts whole configuration, so it can use the information to know which version of package to import. Currently it's only used for fiber but in the future can be used for any other import with major version increment
| gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| ) | ||
|
|
||
| replace github.com/oapi-codegen/fiber-middleware/v2 => github.com/kerak19/fiber-middleware/v2 v2.0.0-20250323205111-59ed66807d2f |
There was a problem hiding this comment.
Created separate PR for this: https://github.com/oapi-codegen/fiber-middleware/pull/19/files
|
New and updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
|
I'll try and get a review at some point - if Fiber are still pushing out breaking changes to v3 I'd be concerned that this may mean we'll have more work keeping this working 🤔 |
|
Hi guys, any plans to finish this topic? |
|
I'm also curious, fiber |
|
Looks like fiber v3 released recently: https://github.com/gofiber/fiber/releases/tag/v3.0.0 @jamietanna if you agree I can update this PR |
|
@jamietanna please forgive the annoyance, but naturally there are some breaking changes between fiber v2 and v3. Would it be possible to merge this PR? |
|
I took the PR that @kerak19 and resolved the merge conflicts as well as some of the other issues. |
|
Thanks for doing this, but I've merged a different, more recent PR, which adds Fiber V3 support to a supported version: |
Add fiber v3 server support Add a `fiber-v3-server` generation target (fiber v3 requires Go 1.25+), continuing #1937. - Add `fiber-v3` and `strict-fiber-v3` template sets, derived from the fiber v2 templates and adapted to the fiber v3 API: `fiber.Ctx` is passed by value, request bodies use `ctx.Bind().Body`, scopes are set via `c.RequestCtx().SetUserValue`, and `GetReqHeaders` returns `map[string][]string`. - Wire up generation: the `fiber-v3-server` config flag (plus the deprecated `-generate fiber-v3` CLI alias), imports via `GenerateOptions.RouterImports()`, the single-server validation check, and the JSON configuration schema. No changes to any existing exported API. - Document it in the README server table and docs/fiber-v3-server.md. - Add minimal-server and petstore-expanded examples, depending on the released github.com/oapi-codegen/fiber-v3-middleware v0.1.0 and gofiber/fiber/v3 v3.4.0. Co-authored-by: Łukasz Opasiak <lukasz.opasiak@proton.me> Co-authored-by: Marcin Romaszewicz <marcinr@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This PR adds Fiber v3 support to oapi-codegen.
While Fiber v3 is not yet production ready per link, any code changes concerning oapi code generation should've been easy to manage.
Added
petstore-expandedandminimal-serverexamples.Updated Readme to contain Fiber v3 paragraph.