Skip to content
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

RFC: Null-Only-On-Error / Semantically-Non-Null type (asterisk) #1048

Closed
wants to merge 3 commits into from

Conversation

benjie
Copy link
Member

@benjie benjie commented Oct 4, 2023

This PR replaces #1046. Here's an updated description:

Inspired by @captbaritone's True Nullability Schema discussion (graphql/graphql-wg#1394) and following @fotoetienne's excellent talk at GraphQLConf and feedback on my resulting PR #1046, I am proposing that we introduce a new wrapper type, the "Null-Only-On-Error" type, represented via asterisk *. This new type walks the line between the default nullable types and the existing Non-Null type wrapper - it states that the value may only be {null} if a field error has been raised - i.e. it represents the "true nullability" of the field, whilst still acting as an error boundary to avoid null propagation.

Critically, this type would "evaporate" for legacy clients, appearing the same as a nullable field. (This is enabled via the includeNullOnlyOnError argument to the __Field.type field, which defaults to false.)

This is a much more complete RFC that #1046 was, and happily leverages a lot of the existing behavior of the spec.

@netlify
Copy link

netlify bot commented Oct 4, 2023

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit 23fa23b
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/6560820284eeb9000889be18
😎 Deploy Preview https://deploy-preview-1048--graphql-spec-draft.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@benjie
Copy link
Member Author

benjie commented Oct 5, 2023

See also directive for disabling null bubbling built on top of this.

@benjie benjie changed the title RFC: Null-Only-On-Error type (asterisk) RFC: Null-Only-On-Error / Semantically-Non-Null type (asterisk) Oct 6, 2023
@benjie benjie force-pushed the asterisk branch 3 times, most recently from 8395fd5 to 23fa23b Compare November 24, 2023 10:59
@benjie
Copy link
Member Author

benjie commented Nov 24, 2023

Closed in favour of #1065

@benjie benjie closed this Nov 24, 2023
@benjie benjie added the 💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md) label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💭 Strawman (RFC 0) RFC Stage 0 (See CONTRIBUTING.md)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant