Schema with Union Types

In the previous lesson, we learned how the schema interface in GraphQL could be used to ensure that Pizza always represents a mandatory set of types. Union types are similar to interfaces, but they don’t specify any standard fields between the types.

How to implement union types in GraphQL server

To implement union in the GraphQL server, you need to follow these steps:

  • Edit the typeDefs variable and add the VariousPizza as enum with types Pizza, ChicagoPizza, and DominoPizza.

Get hands-on with 1200+ tech skills courses.