Skip to content

Commit

Permalink
better SemanticNullable docs
Browse files Browse the repository at this point in the history
  • Loading branch information
twof committed Nov 8, 2024
1 parent 24474fa commit af58560
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/type/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,24 +548,21 @@ export class GraphQLSemanticNonNull<T extends GraphQLNullableType> {
/**
* Semantic-Nullable Type Wrapper
*
* A semantic-non-null is a wrapping type which points to another type.
* Semantic-non-null types enforce that their values are never null unless
* caused by an error being raised. It is useful for fields which you can make
* a guarantee on non-nullability in a no-error case, for example when you know
* that a related entity must exist (but acknowledge that retrieving it may
* produce an error).
* A semantic-nullable is a wrapping type which points to another type.
* Semantic-nullable types allow their values to be null.
*
* Example:
*
* ```ts
* const RowType = new GraphQLObjectType({
* name: 'Row',
* fields: () => ({
* email: { type: new GraphQLSemanticNonNull(GraphQLString) },
* email: { type: new GraphQLSemanticNullable(GraphQLString) },
* })
* })
* ```
* Note: the enforcement of non-nullability occurs within the executor.
* Note: This is equivalent to the unadorned named type that is
* used by GraphQL when it is not operating in SemanticNullability mode.
*
* @experimental
*/
Expand Down

0 comments on commit af58560

Please sign in to comment.