Schema with Union Types
Understand the union types in GraphQL.
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 theVariousPizza
asenum
with typesPizza
,ChicagoPizza
, andDominoPizza
.
Get hands-on with 1400+ tech skills courses.