Skip to content

Support RouterGroup when registering handlers with gin #507

Description

@msvechla

Hello,

Currently, it's not possible to register the handlers on a gin RouterGroup.
This could be helpful, because one might register the openapi handlers on a router group with special middleware configured, with different middleware on some other RouterGroup.

One possible way would be changing the *gin.Engine to *gin.RouterGroup in RegisterHandlers: https://github.com/deepmap/oapi-codegen/blob/master/pkg/codegen/templates/gin/gin-register.tmpl#L8.

However, this would be a breaking change. I am open to any other solutions on this.

I also thought about using the options.Middlewares to specify special middleware used only with the routes from the OpenAPI spec, however, this one does not support the regular gin.Handlerfunc usually used with middleware.

Do you have any suggestions here?
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions