Skip to main content
Latest
function GraphQLNonNull
import { GraphQLNonNull } from "https://deno.land/x/graphql_deno@v15.0.0/lib/type/index.js";

Non-Null Type Wrapper

A non-null is a wrapping type which points to another type. Non-null types enforce that their values are never null and can ensure an error is raised if this ever occurs during a request. It is useful for fields which you can make a strong guarantee on non-nullability, for example usually the id field of a database row will never be null.

Example:

const RowType = new GraphQLObjectType({
  name: 'Row',
  fields: () => ({
    id: { type: GraphQLNonNull(GraphQLString) },
  })
})

Note: the enforcement of non-nullability occurs within the executor.