As you have seen in earlier chapters, queries and mutations can take input via arguments. Since arguments have no inherent semantics attached, and mean whatever you define them to mean, you can easily implement common features like filtering by simply designating arguments to be used for this purpose.

You’ll now apply this idea to add filtering to the already defined allLinks query.

  1. Start by add a new argument to its schema definition

Remember that this exact approach is just an example. You might as well implement filtering using any other format.

  1. Create the corresponding data-class

  2. The logic needs to allow filtering

  3. Finally, update Query to add the new argument to the top-level method:

Cool! Check it out in GraphiQL!

Unlock the next chapter
Is result filtering supported by GraphQL?
Yes, out of the box, via dedicated query arguments
Arguments have no built-in semantics, the implementer can provide arguments used for filtering (like does)
Yes, but only if extensions are installed