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!
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.Engineto*gin.RouterGroupinRegisterHandlers: 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.Middlewaresto specify special middleware used only with the routes from the OpenAPI spec, however, this one does not support the regulargin.Handlerfuncusually used with middleware.Do you have any suggestions here?
Thanks a lot!