...
In
schema.graphqls
define the result we’ll get back from the query by defining the following type:Code Block type local_todo_items_result { items: [local_todo_item!]! }
Notice here we’ve used
!
in two places. This indicates the field is non-nullable. We’ve used this here to say that we always expect an array, by putting the exclamation mark on the outside of the array[...]!
. We also used it to to say that the elements of the array cannot be null[my_type!]
.Now we have the result defined, let’s define the query. We do this by extending the type
Query
and adding our query into it. Let’s do this:Code Block extend type Query { local_todo_items: local_todo_items_result! }
This defines that the query
local_todo_items
should return thelocal_todo_items_result
type we defined earlier.
Creating the persisted query
...