graphql-python / graphql-python/graphql-relay-py

Why are nodes optional?

未关闭
#19 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
144
派生
41
PR 合并指标
30 天内没有已合并 PR

描述

I was trying to dig through this to figure it out, and I apologize if there's a good reason for this.

It seems to me that a paginated connection (e.g. `DjangoConnectionField` or `DjangoFilterConnectionField`) always has edges and nodes. What's the use case for these being nullable?

The reason I bring this up is because, when using TypeScript with the generated schema, it results in lengthy checks like this:

```tsx
{edges.map(edge => (


{edge &&
edge.node &&
edge.node.id (
...
```

As far as I can tell this is set up here:
https://github.com/graphql-python/graphql-relay-py/blob/master/graphql_relay/connection/connection.py#L44

Could there be `required` on edges/nodes? At least as an option it'd be a breaking change. Right now I'm not sure how to override this.

贡献指南

这个仓库没有索引到贡献指南

调研方向

阅读 graphql_relay/connection/connection.py 第 44 行附近的内容,以确认 edges 和 nodes 是如何声明的。调查是否可以在不破坏现有 schema 的情况下配置可空性;当存在一个显式选项且生成的 schema 反映所选的可空性时,即视为完成。

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

评估

技术栈
graphql, python
领域
api
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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