March 2018
Intermediate to advanced
304 pages
6h 59m
English
Up to this point, we’ve been adding 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. We could just add them à la carte:
| | @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 |
Mixed in with other arguments that we add to the field, this can quickly become a hodgepodge of various flags and options that would be better organized into related groupings. GraphQL gives us a tool to do this: input object types.
We can collect multiple ...
Read now
Unlock full access