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

Schema Nullability Extensions #5191

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Schema Nullability Extensions #5191

merged 2 commits into from
Aug 17, 2023

Conversation

martinbonnin
Copy link
Contributor

Add Schema Nullability Extensions. This is similar to a @nonnull schema directive but works with lists.

Given the following SDL:

# schema.graphqls
type Query {
  random: Int
  list: [String]
  required: Int!
}

You can extend it like so:

# extra.graphqls
extend type Query {
  # make random non-nullable
  random: Int!
  # make list and list items non-nullable
  list: [String!]!
  # make required nullable
  required: Int
  # add a new field
  new: Float
}

@martinbonnin martinbonnin requested a review from BoD as a code owner August 17, 2023 12:02
@netlify
Copy link

netlify bot commented Aug 17, 2023

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit 0cb7566
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/64de0c4e6e96b40008a33304

@BoD
Copy link
Contributor

BoD commented Aug 17, 2023

Very cool! Just to be sure, this isn't allowed in the spec, right? But would be cool if it was. Similar to allowing adding directives to enum values.

@martinbonnin
Copy link
Contributor Author

this isn't allowed in the spec, right?

Indeed, this is not. allowed. Only new fields are allowed. This is an Apollo addition.

@martinbonnin martinbonnin merged commit 025a5d2 into main Aug 17, 2023
8 checks passed
@martinbonnin martinbonnin deleted the sne branch August 17, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants