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

Why are nodes optional?

Aperta
#19 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
144
Fork
41
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.