Can you make sure that it is the same in general GraphQL Specs? For example, run an Apollo GraphQL server and test it. If it has the same behavior, it is part of GraphQL Spec and you may found why in their docs. If no, we can consider it as a Bug in Dgraph.
I have tested this using a simple Apollo and Hasura Server. The placement of the fragment didn’t matter, it always respected the data requested so this is a bug in Dgraph.
Your query and the fragment are both querying for images { ... }. Is that what you’re expecting? The behavior you’re reporting shows that the query is picking up the first occurrence. Dgraph needs to end up choosing one of the queries on the same field to return.
That is correct. When I tested on Apollo and Hasura both returned back the data I was asking for, no matter the order or how it was broken up in fragments. I’m assuming it is a bug if Dgraph is just choosing one occurrence and ignoring the rest since this isn’t how it is handled on Apollo or Hasura.
Hi! I don’t think Dgraph has the right behaviour here! According to the GraphQL specs, Field Collection should be possible. This non-compliance of Dgraph is actually quite a problem for people using Relay since they sometimes rely on multiple Fragments if they consider using the useFragment hook.
I guess the entire problem is connected to @graphql-codegen. I’m not sure but I think I found the part where field collection according to the GraphQL specs was implemented in the source. Something similar should be possible with the Fragment Matcher plugin but maybe this can only be used with Apollo?
Is there any news from your end since you were saying that you are working on this?