99designs / 99designs/gqlgen

How to access the arguments of a query within the RequestContext Object ?

未关闭
#1,144 12 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
10.8k
派生
1.3k
平均合并
2 天 36 分钟
30 天内合并 PR
26

描述

### What happened?

Hi there,
When trying to obtain the variables from a request context Object (with `graphql.GetRequestContext(ctx).Variables` with the following query:
```
query MyQuery {
queryNode(filter:{isRoot:true}) {
name
}
}
```
I obtain a empty map.

### What did you expect?

` map[filter: map[isRoot:true]]`

Furthermore, I get the desired result if I use
```
query MyQuery($args: MyArgs!) {
queryNode(filter:$args) {
name
}
}

{ "args": {"isRoot": true}}
```

### versions
- glqgen : v0.11.3
- go: 1.14.1
- gqlparser: v2/v2.0.1

贡献指南

打开贡献指南

调研方向

该 issue 涉及在 gqlgen 的 RequestContext 对象中访问查询参数。查看请求上下文处理代码(很可能位于 graphql 包中),以了解变量是如何解析和存储的。检查内联参数和变量参数之间的区别。运行提供的查询以复现空 map 问题,并跟踪变量提取流程。

由索引模型根据 Issue 内容生成。

评估

技术栈
go, graphql
领域
api, backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。