From 1f2d55369d3a120cccd42438159a966caf266b75 Mon Sep 17 00:00:00 2001 From: Alexandre Jin <1076513+Inozuma@users.noreply.github.com> Date: Tue, 19 Jul 2022 17:34:34 +0200 Subject: [PATCH] feat: change OperationFromContext argument type to context.Context Signed-off-by: Alexandre Jin <1076513+Inozuma@users.noreply.github.com> --- fizz.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fizz.go b/fizz.go index e28efaa..dc17f1b 100644 --- a/fizz.go +++ b/fizz.go @@ -1,6 +1,7 @@ package fizz import ( + "context" "errors" "fmt" "net/http" @@ -391,9 +392,9 @@ func XInternal() func(*openapi.OperationInfo) { } // OperationFromContext returns the OpenAPI operation from -// the givent Gin context or an error if none is found. -func OperationFromContext(c *gin.Context) (*openapi.Operation, error) { - if v, ok := c.Get(ctxOpenAPIOperation); ok { +// the given Gin context or an error if none is found. +func OperationFromContext(ctx context.Context) (*openapi.Operation, error) { + if v := ctx.Value(ctxOpenAPIOperation); v != nil { if op, ok := v.(*openapi.Operation); ok { return op, nil }