Our Schema Module

To build a GraphQL API, you’ll need to construct a GraphQL schema, which defines its domain model and how data is retrieved. That can seem pretty overwhelming at first, so we’ll help you start by showing you where to put the schema and ease you into your first query.

We want this schema to support clients of our API accessing a list of menu items. An example query from a client might look something like this:

​ {
​  menuItems {
​  name
​  }
​ }

If the user was talking to us, this would translate to “Give me the names of all of the menu items that you have.” Here’s a sample of the type of JSON they’d expect in response:

​ {
​  ​"data"​: {
​  ​"menuItems"​: [
​  {​"name"​: ​"Reuben" ...

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.