March 2018
Intermediate to advanced
304 pages
6h 59m
English
In the last section, you saw variable declarations that featured use of exclamation marks to ensure variable values were provided. It looked something like this:
| | query ($filter: MenuItemFilter!) { |
| | menuItems(filter: $filter) { |
| | name |
| | } |
| | } |
The document here declares that the $filter variable is a MenuItemFilter, while the addition of an exclamation mark denotes that a value is mandatory. This is a constraint that the document designer (usually a front-end developer) builds into the query, but the schema designer can enforce non-null constraints on the backend as well.
Let’s say, for instance, that we wanted to ensure that a filter was always provided to the :menu_items field, regardless of what the ...
Read now
Unlock full access