diff --git a/examples/gin-compat/handlers.go b/examples/gin-compat/handlers.go index 1e8d205d..a6cbfd19 100644 --- a/examples/gin-compat/handlers.go +++ b/examples/gin-compat/handlers.go @@ -7,25 +7,27 @@ import ( "github.com/gin-gonic/gin" "github.com/go-fuego/fuego" - "github.com/go-fuego/fuego/extra/fuegogin" ) func ginController(c *gin.Context) { c.String(200, "pong") } -func fuegoControllerGet(c fuegogin.ContextNoBody) (HelloResponse, error) { +func fuegoControllerGet(c fuego.ContextNoBody) (HelloResponse, error) { return HelloResponse{ Message: "Hello", }, nil } -func fuegoControllerPost(c fuegogin.ContextWithBody[HelloRequest]) (HelloResponse, error) { +func fuegoControllerPost(c fuego.ContextWithBody[HelloRequest]) (HelloResponse, error) { body, err := c.Body() if err != nil { return HelloResponse{}, err } + ctx := c.Context().(*gin.Context) + fmt.Printf("%#v", ctx) + name := c.QueryParam("name") return HelloResponse{ diff --git a/extra/fuegogin/adaptor.go b/extra/fuegogin/adaptor.go index af8c676b..563b47de 100644 --- a/extra/fuegogin/adaptor.go +++ b/extra/fuegogin/adaptor.go @@ -56,7 +56,9 @@ func GinHandler[B, T any](handler func(c fuego.ContextWithBody[B]) (T, error)) g return func(c *gin.Context) { context := &ginContext[B]{ CommonContext: internal.CommonContext[B]{ - CommonCtx: c, + CommonCtx: c, + UrlValues: c.Request.URL.Query(), + OpenAPIParams: map[string]fuego.OpenAPIParam{}, }, ginCtx: c, } diff --git a/go.work b/go.work index 7191582c..9cfed395 100644 --- a/go.work +++ b/go.work @@ -9,6 +9,7 @@ use ( ./examples/custom-serializer ./examples/full-app-gourmet ./examples/generate-opengraph-image + ./examples/gin-compat ./examples/hello-world ./examples/openapi ./extra/fuegogin