Setting Defaults
Now that we feel comfortable with def middleware, weâre in a good place to address an important question: how do fields without specific resolvers actually resolve anything? Throughout the entire book so far, weâve had stuff in our schema like this:
â | object â:menu_itemâ âdoâ |
â | field â:nameâ, â:stringâ |
â | â# ... other fieldsâ |
â | âendâ |
Despite the fact that the :name field has no obvious resolver, we nonetheless can include it in a GraphQL query and we get a result. What we need to do is look at what actually happens here because what youâll find is not only a feature you can use yourself, but more importantly, a tool you can customize as necessary when the default behavior doesnât suit ...
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.