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

[2021-05-13] Query Level Nullability - open PR #694

Closed
benjie opened this issue Jun 1, 2021 · 8 comments
Closed

[2021-05-13] Query Level Nullability - open PR #694

benjie opened this issue Jun 1, 2021 · 8 comments
Assignees
Labels
Action item 🎬 Ready for review 🙌 Action Item issues are reviewed and closed during Working Group meetings.

Comments

@benjie
Copy link
Member

benjie commented Jun 1, 2021

ACTION [Alex Reilly, Liz Jakubowski, Mark Larah, Sanae Rosen, Stephen Spalding, Wei Xue, Young Min Kim] - we'll open up a PR. We've a partial implementation on GraphQL.js


Note: Action Item issues are reviewed and closed during Working Group
meetings.

@benjie
Copy link
Member Author

benjie commented Jun 1, 2021

@twof is this complete? I recall seeing some issues created.

@twof
Copy link
Contributor

twof commented Jun 1, 2021

@benjie hey thanks for checking in! We've been working on the implementation first, and then we'll be turning it into a fully fledged RFC. People can track progress on the implementation in this GraphQL.js fork And comment on the strawman issue for now until we have something comprehensive up.

@twof
Copy link
Contributor

twof commented Oct 7, 2021

GraphQL.js PR is up for review and we're looking for feedback: graphql/graphql-js#3281

kitten added a commit to 0no-co/graphql-web-lite that referenced this issue Oct 8, 2021
The ["Nullability RFC" for GraphQL](graphql/graphql-wg#694)
allows fields to individually be marked as optional or required in a query by the
client-side. ([See Strawman Proposal](graphql/graphql-spec#867))

If a field is marked as optional then it's allowed to be missing and `null`, which
can control where missing values cascade to:

```graphql
query {
  me {
    name?
  }
}
```

If a field is marked as required it may never be allowed to become `null` and must
cascade if it otherwise would have been set to `null`:

```graphql
query {
  me {
    name!
  }
}
```
kitten added a commit to urql-graphql/urql that referenced this issue Oct 8, 2021
The ["Nullability RFC" for GraphQL](graphql/graphql-wg#694)
allows fields to individually be marked as optional or required in a query by the
client-side. ([See Strawman Proposal](graphql/graphql-spec#867))

If a field is marked as optional then it's allowed to be missing and `null`, which
can control where missing values cascade to:

```graphql
query {
  me {
    name?
  }
}
```

If a field is marked as required it may never be allowed to become `null` and must
cascade if it otherwise would have been set to `null`:

```graphql
query {
  me {
    name!
  }
}
```

In Graphcache, we imagine that the nullable field — which would be marked with
`required: 'optional'` — can allow Graphcache to make more data nullable and
hence partial, which enhances schema awareness, even if it's not actively used.

The required fields — which would be marked with `required: 'required'` — would
force Graphcache to include this data, regardless of what schema awareness may
say, which also enhances partial data in the presence of schema awareness, since
it increases what the cache may deliver.

In other words, it guarantees a "forced outcome" in both cases, without having to
look up whether a field is nullable in the schema.
In the future, we may even derive the `RequiredStatus` of a `FieldNode` in an
external place and never call `isFieldNullable` with a schema in the query
traversal.
@twof
Copy link
Contributor

twof commented Oct 12, 2021

Here are a couple docs we've been working on that might be helpful for people reviewing the RFC:
Known issues with the proposal
A list of tests and justifications for their behavior

@twof
Copy link
Contributor

twof commented Oct 14, 2021

All CI checks are passing on our GraphQL.js branch

@benjie benjie added the Ready for review 🙌 Action Item issues are reviewed and closed during Working Group meetings. label Oct 18, 2021
@twof
Copy link
Contributor

twof commented Oct 18, 2021

Spec changes will be happening in this branch: graphql/graphql-spec#895

The PR is not yet ready for review, but I'll update here when it is.

@twof
Copy link
Contributor

twof commented Oct 19, 2021

The spec PR is ready for review!

@twof
Copy link
Contributor

twof commented Nov 4, 2021

@leebyron leebyron closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Action item 🎬 Ready for review 🙌 Action Item issues are reviewed and closed during Working Group meetings.
Projects
None yet
Development

No branches or pull requests

3 participants