Input Objects

Learn how we use input objects in GraphQL.

We'll cover the following...

Modeling input objects

In the previous lesson, we added arguments directly onto our fields. But, this can get messy. Imagine, for instance, if we wanted to add various filtering options to our :menu_items field:

Press + to interact
@desc "Matching a category name"
arg :category, :string
@desc "Matching a tag"
arg :tag, :string
@desc "Priced above a value"
arg :priced_above, :float
@desc "Priced below a value"
arg :priced_below, :float

We can collect multiple arguments and model them as a special object type used just for argument values. Let’s take the :category, :tag, :priced_above, and :priced_below arguments and group them together into a ...