mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-05 15:10:49 +00:00
replace 4-space with tabs in go templates
This commit is contained in:
parent
fdb001c8a3
commit
0d1b14a75f
@ -26,25 +26,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
|
|||||||
|
|
||||||
// NewRouter add routes to existing gin engine.
|
// NewRouter add routes to existing gin engine.
|
||||||
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
|
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
|
||||||
for _, route := range getRoutes(handleFunctions) {
|
for _, route := range getRoutes(handleFunctions) {
|
||||||
if route.HandlerFunc == nil {
|
if route.HandlerFunc == nil {
|
||||||
route.HandlerFunc = DefaultHandleFunc
|
route.HandlerFunc = DefaultHandleFunc
|
||||||
}
|
}
|
||||||
switch route.Method {
|
switch route.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
router.GET(route.Pattern, route.HandlerFunc)
|
router.GET(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
router.POST(route.Pattern, route.HandlerFunc)
|
router.POST(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPut:
|
case http.MethodPut:
|
||||||
router.PUT(route.Pattern, route.HandlerFunc)
|
router.PUT(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPatch:
|
case http.MethodPatch:
|
||||||
router.PATCH(route.Pattern, route.HandlerFunc)
|
router.PATCH(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodDelete:
|
case http.MethodDelete:
|
||||||
router.DELETE(route.Pattern, route.HandlerFunc)
|
router.DELETE(route.Pattern, route.HandlerFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default handler for not yet implemented routes
|
// Default handler for not yet implemented routes
|
||||||
|
@ -34,25 +34,25 @@ func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine {
|
|||||||
|
|
||||||
// NewRouter add routes to existing gin engine.
|
// NewRouter add routes to existing gin engine.
|
||||||
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
|
func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine {
|
||||||
for _, route := range getRoutes(handleFunctions) {
|
for _, route := range getRoutes(handleFunctions) {
|
||||||
if route.HandlerFunc == nil {
|
if route.HandlerFunc == nil {
|
||||||
route.HandlerFunc = DefaultHandleFunc
|
route.HandlerFunc = DefaultHandleFunc
|
||||||
}
|
}
|
||||||
switch route.Method {
|
switch route.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
router.GET(route.Pattern, route.HandlerFunc)
|
router.GET(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
router.POST(route.Pattern, route.HandlerFunc)
|
router.POST(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPut:
|
case http.MethodPut:
|
||||||
router.PUT(route.Pattern, route.HandlerFunc)
|
router.PUT(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodPatch:
|
case http.MethodPatch:
|
||||||
router.PATCH(route.Pattern, route.HandlerFunc)
|
router.PATCH(route.Pattern, route.HandlerFunc)
|
||||||
case http.MethodDelete:
|
case http.MethodDelete:
|
||||||
router.DELETE(route.Pattern, route.HandlerFunc)
|
router.DELETE(route.Pattern, route.HandlerFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default handler for not yet implemented routes
|
// Default handler for not yet implemented routes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user