gqlgen icon indicating copy to clipboard operation
gqlgen copied to clipboard

OperationContext contains empty variables for variable with query

Open khumps opened this issue 6 months ago • 0 comments

What happened?

setting up the following for the handler

srv.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
		oc := graphql.GetOperationContext(ctx)
		fmt.Printf("%+v", oc.Variables)
		return next(ctx)
	})

prints map[] on the following query

query Query {
  genConfigJson(id: 1234567)
}

The query succeeds and returns data in graphiql

What did you expect?

the print statement should have printed {"id":1234567}

Minimal graphql.schema and models to reproduce

scalar Map

type Query {
  genConfigJson(id: [Int!]): [Map!]
}

versions

  • go run github.com/99designs/gqlgen version? Initially tried with v0.17.44. Updated to v0.17.49 and it still happens
  • go version? go version go1.22.4 linux/amd64

khumps avatar Aug 14 '24 15:08 khumps