-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial - Update Link.comments return type #3545
Conversation
|
Apollo Federation Subgraph Compatibility Results
Learn more: |
💻 Website PreviewThe latest changes are available as preview in: https://979f63a9.graphql-yoga.pages.dev |
✅ Benchmark Results
|
case, when they will generate the types on their end. | ||
1. `comments: [Comment]` | ||
2. `comments: [Comment!]` | ||
3. `comments: [Comment!]!` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We even have a fourth option: comments: [Comment]!
. I don't know if it's worth explaining this one too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would you write about that?
can you add a text similar to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option 4,
[Comment]!
, shares semantics with option 1 and 3. Like 1 the array elements can benull
orComment
, but like 3, the field itself will always be an array, nevernull
. This type formulation is rarely used because simply omitting a value from the array is typically sufficient to indicate its non-valueless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe alter the documentation here to talk about two aspects which cut across all four combinations:
- nullable array elements
- nullable array
After talking about those two aspects, one can simply reference which aspects apply to which combinations.
Then, a final word about which formulation is the most popular and why ([X!]!
because it provides the simplest way to sufficiently model empty states blah blah).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shit I missed your comment!
can you create a short PR just with some words?
I can then take the time to turn it into something readable
Co-authored-by: Valentin Cocaud <v.cocaud@gmail.com>
I was thinking about this again and went back to the original type :)
But it was after I learned a lot from @n1ru4l and @eddeee888 and I've added many more comments about the comments return types and why we chose this, so I think overall it was worth the long trip...