Imagine you've define an Operation like this:
Now let's say, you'd like to "filter" the missions using an extra variable.
Doing so, you could implement a hook:
Let's modify our Query:
As you can see, we've defined an additional variable. By default, this Operation would be invalid though. This is because we're violating the GraphQL validation rules. GraphQL Variables must always be used within the document. However, our intention is to not use this Variable within the GraphQL Query but pass it on to the Hook. This is what the
@hooksVariable directive is meant for. By applying it to a Variable, we'll remove it from the GraphQL Query but will keep it in the JSON Schema Definition of the Operation.
As a result, we're no able to use the filter Variable from within the hook: