I have a problem with my project and I can not find any solution on the Internet. Here is the situation.
- I have a Union (
DataResult ) of 2 types ( Teaser and Program ) - I have a
Zone type with data field (array DataResult ) Teaser & Program have the same title field with a different type ( String and String! )
Here are parts of the Zone , Teaser and Program diagrams:
type Program { title: String } type Teaser { title: String! } union DataResult = Teaser | Program type Zone { (...) data: [DataResult!] }
When I tried to query the zone data as described in the part of the query below, I had an error in GraphQL.
zones { ...zoneFieldsWithoutData data { ... on Program { ...programFields } ... on Teaser { ...teaserFields } } }
Here is the error:
Error: GraphQL error: Fields \"title\" conflict because they return conflicting types String and String!. Use different aliases on the fields to fetch both if this was intentional
I cannot use an alias because the specs need the same attribute name for all DataResult objects. What can I do?
Moreover, even if I set the same type for title , I will get many warnings about "missing fields" in the console ....
PS: I use Vanilla Apollo as a GraphQL client (server side)
source share