File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ func main() {
1313 apiSetExternalDocs (& apiDoc )
1414 apiSetComponents (& apiDoc )
1515
16- apiDoc .AttachRoutes ([]interface {} {
16+ apiDoc .AttachRoutes ([]docs. RouteFn {
1717 handleCreateUserRoute ,
1818 handleGetUserRoute ,
1919 })
Original file line number Diff line number Diff line change @@ -6,9 +6,16 @@ import (
66 "strings"
77)
88
9- type RegRoutes map [string ]interface {}
9+ type (
10+ // RouteFn represents a typeFunc which needs to be satisfied in order to use default routes attaching method.
11+ RouteFn func (index int , oas * OAS )
1012
11- func (o * OAS ) AttachRoutes (fns []interface {}) {
13+ // RegRoutes represent a map of RouteFn's.
14+ // TODO: Will this get Deprecated?
15+ RegRoutes map [string ]RouteFn
16+ )
17+
18+ func (o * OAS ) AttachRoutes (fns []RouteFn ) {
1219 for _ , fn := range fns {
1320 fnDeclaration := runtime .FuncForPC (reflect .ValueOf (fn ).Pointer ()).Name ()
1421 fields := strings .SplitAfter (fnDeclaration , "." )
You can’t perform that action at this time.
0 commit comments