facebook / facebook/relay

Relay spec: start/endCursor nonNull conflicts with when there are no results

Open
#3,708 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

the Relay spec says:
` It must also contain fields startCursor and endCursor, both of which return non-null opaque strings.`

But it doesn't explain what to do when there are no results

the only two realistic options I see are returning a garbage cursor or breaking spec and returning null

Graphql-Relay-JS chooses to ignore the spec and return null
https://github.com/graphql/graphql-relay-js/blob/3796e0904fbfe0dd86e540d5b4df236330c8a5e7/src/connection/arrayConnection.ts

As does Java:
https://github.com/graphql-java/graphql-java/blob/1ee9630c7d25ccb55a5b1d9b1ccf7bf7895a8c7f/src/main/java/graphql/relay/Relay.java#L54

IMHO the spec should be updated to allow null for these values (as the ecosystem already ignore it)

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.