diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache index ba4dd203977..29bf6321dd0 100644 --- a/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache +++ b/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache @@ -26,25 +26,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine { // NewRouter add routes to existing gin engine. func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine { - for _, route := range getRoutes(handleFunctions) { - if route.HandlerFunc == nil { - route.HandlerFunc = DefaultHandleFunc - } - switch route.Method { - case http.MethodGet: - router.GET(route.Pattern, route.HandlerFunc) - case http.MethodPost: - router.POST(route.Pattern, route.HandlerFunc) - case http.MethodPut: - router.PUT(route.Pattern, route.HandlerFunc) - case http.MethodPatch: - router.PATCH(route.Pattern, route.HandlerFunc) - case http.MethodDelete: - router.DELETE(route.Pattern, route.HandlerFunc) - } - } + for _, route := range getRoutes(handleFunctions) { + if route.HandlerFunc == nil { + route.HandlerFunc = DefaultHandleFunc + } + switch route.Method { + case http.MethodGet: + router.GET(route.Pattern, route.HandlerFunc) + case http.MethodPost: + router.POST(route.Pattern, route.HandlerFunc) + case http.MethodPut: + router.PUT(route.Pattern, route.HandlerFunc) + case http.MethodPatch: + router.PATCH(route.Pattern, route.HandlerFunc) + case http.MethodDelete: + router.DELETE(route.Pattern, route.HandlerFunc) + } + } - return router + return router } // Default handler for not yet implemented routes diff --git a/samples/server/petstore/go-gin-api-server/go/routers.go b/samples/server/petstore/go-gin-api-server/go/routers.go index 0a8bf04ea30..93a82020734 100644 --- a/samples/server/petstore/go-gin-api-server/go/routers.go +++ b/samples/server/petstore/go-gin-api-server/go/routers.go @@ -34,25 +34,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine { // NewRouter add routes to existing gin engine. func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine { - for _, route := range getRoutes(handleFunctions) { - if route.HandlerFunc == nil { - route.HandlerFunc = DefaultHandleFunc - } - switch route.Method { - case http.MethodGet: - router.GET(route.Pattern, route.HandlerFunc) - case http.MethodPost: - router.POST(route.Pattern, route.HandlerFunc) - case http.MethodPut: - router.PUT(route.Pattern, route.HandlerFunc) - case http.MethodPatch: - router.PATCH(route.Pattern, route.HandlerFunc) - case http.MethodDelete: - router.DELETE(route.Pattern, route.HandlerFunc) - } - } + for _, route := range getRoutes(handleFunctions) { + if route.HandlerFunc == nil { + route.HandlerFunc = DefaultHandleFunc + } + switch route.Method { + case http.MethodGet: + router.GET(route.Pattern, route.HandlerFunc) + case http.MethodPost: + router.POST(route.Pattern, route.HandlerFunc) + case http.MethodPut: + router.PUT(route.Pattern, route.HandlerFunc) + case http.MethodPatch: + router.PATCH(route.Pattern, route.HandlerFunc) + case http.MethodDelete: + router.DELETE(route.Pattern, route.HandlerFunc) + } + } - return router + return router } // Default handler for not yet implemented routes