Skip to content

Update schema and types docs #1800

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

Merged
merged 12 commits into from
Nov 8, 2024
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Benjie <[email protected]>
  • Loading branch information
mandiwise and benjie authored Oct 24, 2024
commit 9ffd722ee30b689f90974e22e62dd73833ce6789
4 changes: 2 additions & 2 deletions src/pages/learn/schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ This means that wherever we use the type `Episode` in our schema, we expect it t

## Type modifiers

Types are assumed to be nullable and singular by default in GraphQL. However, when you use these named types in a schema (or in [query variable declarations](/learn/queries/#variables)) you can apply additional _type modifiers_ that will affect the validation of those values.
Types are assumed to be nullable and singular by default in GraphQL. However, when you use these named types in a schema (or in [query variable declarations](/learn/queries/#variables)) you can apply additional _type modifiers_ that will affect the meaning of those values.

As we saw with the Object type example above, GraphQL supports two type modifiers—the [List](https://spec.graphql.org/October2021/#sec-List) and [Non-Null](https://spec.graphql.org/October2021/#sec-List) types—and they can be used individually or in combination with each other.

Expand All @@ -179,7 +179,7 @@ type Character {
}
```

Here, we're using a `String` type and marking it as a Non-Null type by adding an exclamation mark (`!`) after the type name. This means that our server always expects to return a non-null value for this field, and if it receives a null value, then that will trigger a GraphQL execution error, letting the client know that something has gone wrong.
Here, we're using a `String` type and marking it as a Non-Null type by adding an exclamation mark (`!`) after the type name. This means that our server always expects to return a non-null value for this field, and if the resolver produces a null value, then that will trigger a GraphQL execution error, letting the client know that something has gone wrong.

As we saw in an example above, the Non-Null type modifier can also be used when defining arguments for a field, which will cause the GraphQL server to return a validation error if a null value is passed as that argument:

Expand Down