Importing Fields Macro

Learn the fields module and how we import it in our application.

We'll cover the following

Importing fields

To support breaking up a large object, Absinthe provides another macro, import_fields, that we can use. In our hypothetical future for PlateSlate, let’s say our root query object type has fields that provide the following:

  • Information about menu items.
  • Specialized search functions for allergens.
  • Customer and order history queries.
  • Staff schedule details.
  • Restaurant location address information for mapping.

Instead of having an exhaustive query object in our schema.ex spanning hundreds of lines, it could also look like this:

Get hands-on with 1400+ tech skills courses.