You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope I have just missed it, but it seems there is now way to make a graphql client forward compatible so that a server can add a new type to an existing union without breaking the client.
E.g. I imagine a query like:
query {
trafficLight {
__typename
... on Green {
field1
field2
}
... on Red {
field3
field4
}
... on *default {
???
}
}
}
Is something like that already in the Spec or any reason it's not in there and a way to work around it?
The text was updated successfully, but these errors were encountered:
Looking at your example, if there are fields that you can query on any arbitrary future type (???) then what you have is actually an interface, not a union.
Unions are forward compatible, clients must be written to support this. Typically this is handled with a switch statement with a default case that either does nothing (return null) or displays a placeholder indicating that the data is not supported/understood; e.g.:
I hope I have just missed it, but it seems there is now way to make a graphql client forward compatible so that a server can add a new type to an existing union without breaking the client.
E.g. I imagine a query like:
Is something like that already in the Spec or any reason it's not in there and a way to work around it?
The text was updated successfully, but these errors were encountered: