Open caizhigang97 opened 6 years ago
Same problem, can anyone help with that?
You can use the fragment syntax to discriminate from which of the union types you want to query the fields, e.g. see https://facebook.github.io/graphql/June2018/#sec-Unions :
union SearchResult = Photo | Person
type Person {
name: String
age: Int
}
type Photo {
height: Int
width: Int
}
type SearchQuery {
firstSearchResult: SearchResult
}
Query:
{
firstSearchResult {
... on Person {
name
}
... on Photo {
height
}
}
}
Hello everyone! Please look at the code:
Can not run,How to define multi-type result? Thanks~