graphql-python / graphql-python/gql

DSL: Compose query with all nested fields included

未关闭
#316 5 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
type: feature
主要语言
Python
星标
1.7k
派生
195
PR 合并指标
30 天内没有已合并 PR

描述

Hello!

I'm building my query dynamically. I want to select all the nested sub fields _(children, grand children etc)_. Is there a way to accomplish this with `gql`?

I'm not very fluent in graphql but I do know it's possible to build infinite nested queries, so is it even possible/easy to prevent that from happening?

I've experimented with looping through `ds.Content._type.fields` to somehow select each field and any children they might parent. But I find it confusing as some objects contains `of_type` attribute while others do not and I don't know why that is.

Might I be better off doing an introspection with

```graphql
{
__schema {
types {
name
fields {
name
}
}
}
}
```

and determine any children by simply parsing the json data? Seems redundant.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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