99designs / 99designs/gqlgen

OperationContext contains empty variables for variable with query

Open
#3,223 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.8k
Forks
1.3k
Avg merge
2d 36m
Merged PRs (30d)
26

Description

### What happened?

setting up the following for the handler
```go
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
```graphql
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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.