Non-null Constraints
Explore how to enforce non-null constraints on GraphQL arguments using the Absinthe non_null macro. Understand why marking inputs as mandatory improves API validation, error handling, and schema accuracy for more robust GraphQL queries and mutations.
We'll cover the following...
We'll cover the following...
Marking arguments as non-null
Exclamation marks are used in variable declarations to ensure that variable values are provided:
The document here declares that the $filter variable is a MenuItemFilter. Adding an exclamation mark denotes a mandatory value. This is a constraint that the document designer builds into the query, but the schema designer can also enforce non_null ...