Abstract Types

Learn what abstract types are and how we use these types in our application.

We'll cover the following

Understanding abstract types

To support an easy-to-use, flexible API for users, we need to go beyond concrete types of modeling and learn to use abstract types as well. Let’s look at a quick example. A standard feature for a user interface is a search function. How would we implement a search function for our PlateSlate application that allows users to retrieve both menu items and menu item categories that match a search term?

With only our concrete types in place, we’re stuck with building this feature as two separate fields. After all, a GraphQL field can only resolve to a single type. Here’s about the best that our users can hope for:

Get hands-on with 1400+ tech skills courses.