Unions are used when we want a GraphQL field or list to handle multiple types of data. With a Union Type, we can define a field that could resolve completely different types of data. In this lesson, we will write a query that obtains a list of different pet types
Unit type, we cannot use common field in query, I have to write in fragment:
# Write your query or mutation here query { familyPets { __typename, ... on Cat { name }, ... on Dog { name } } }
原文地址:https://www.cnblogs.com/Answer1215/p/11384642.html
时间: 2024-10-12 13:46:00