Defining Field Arguments

GraphQL documents are made up of fields. The user lists the fields they would like, and the schema uses its definition of those fields to resolve the pieces of data that match. The system would be pretty inflexible if it did not also allow users to provide additional parameters that would clarify exactly what information each field needed to find. A user requesting information about menuItems, for instance, may want to see certain menu items or a certain number of them.

It’s for this reason that GraphQL has the concept of field arguments: a way for users to provide input to fields that can be used to parameterize their queries. Let’s take a look at our example application and see how we can extend our Absinthe schema ...

Get Craft GraphQL APIs in Elixir with Absinthe now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.