Skip to content

Commit

Permalink
feat: change OperationFromContext argument type to context.Context (#84)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Jin <1076513+Inozuma@users.noreply.github.com>
  • Loading branch information
Inozuma committed Jul 19, 2022
1 parent aaea309 commit 923277f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fizz.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fizz

import (
"context"
"errors"
"fmt"
"net/http"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 923277f

Please sign in to comment.