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: (graphcache) - Nullability Operators #2018

Closed
wants to merge 6 commits into from
Closed

Commits on Oct 8, 2021

  1. Implement nullability operators in Graphcache

    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.
    kitten committed Oct 8, 2021
    Configuration menu
    Copy the full SHA
    82fdbdc View commit details
    Browse the repository at this point in the history
  2. v4.3.6-spec-nullability

    kitten committed Oct 8, 2021
    Configuration menu
    Copy the full SHA
    eafe9a4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d0fae14 View commit details
    Browse the repository at this point in the history
  4. v4.3.6-spec-nullability-1

    kitten committed Oct 8, 2021
    Configuration menu
    Copy the full SHA
    b119bc7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    38b9acc View commit details
    Browse the repository at this point in the history
  6. v4.3.6-spec-nullability-2

    kitten committed Oct 8, 2021
    Configuration menu
    Copy the full SHA
    2e1af29 View commit details
    Browse the repository at this point in the history