Skip to content

Commit

Permalink
Return Router interface from controller constructor. (#4196)
Browse files Browse the repository at this point in the history
Update the go server api controller template to return the Router interface instead of the api specific router.
The Router interface type has the Routes function, which is what the generated `NewRouter` function needs. (not the api specific interface).
  • Loading branch information
Jesse Michael authored and wing328 committed Oct 22, 2019
1 parent 9fe2f4d commit 00c6e0a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type {{classname}}Controller struct {
}

// New{{classname}}Controller creates a default api controller
func New{{classname}}Controller(s {{classname}}Servicer) {{classname}}Router {
func New{{classname}}Controller(s {{classname}}Servicer) Router {
return &{{classname}}Controller{ service: s }
}

Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/go-api-server/go/api_pet.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type PetApiController struct {
}

// NewPetApiController creates a default api controller
func NewPetApiController(s PetApiServicer) PetApiRouter {
func NewPetApiController(s PetApiServicer) Router {
return &PetApiController{ service: s }
}

Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/go-api-server/go/api_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type StoreApiController struct {
}

// NewStoreApiController creates a default api controller
func NewStoreApiController(s StoreApiServicer) StoreApiRouter {
func NewStoreApiController(s StoreApiServicer) Router {
return &StoreApiController{ service: s }
}

Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/go-api-server/go/api_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type UserApiController struct {
}

// NewUserApiController creates a default api controller
func NewUserApiController(s UserApiServicer) UserApiRouter {
func NewUserApiController(s UserApiServicer) Router {
return &UserApiController{ service: s }
}

Expand Down

0 comments on commit 00c6e0a

Please sign in to comment.