github.com/opiuman/genqlient@v1.0.0/generate/testdata/queries/ComplexInlineFragments.graphql (about) 1 # We test all the spread cases from docs/DESIGN.md, see there for more context 2 # on each, as well as various other nonsense. But for abstract-in-abstract 3 # spreads, we can't test cases (4b) and (4c), where I implements J or vice 4 # versa, because gqlparser doesn't support interfaces that implement other 5 # interfaces yet. 6 query ComplexInlineFragments { 7 root { 8 id 9 ... on Topic { schoolGrade } # (1) object spread in object scope 10 ... on Content { name } # (3) abstract spread in object scope 11 } 12 randomItem { 13 id 14 ... on Article { text } # (2) object spread in abstract scope 15 ... on Content { name } # (4a) abstract spread in abstract scope, I == J 16 ... on HasDuration { duration } # (4d) abstract spread in abstract scope, neither implements the other 17 } 18 repeatedStuff: randomItem { 19 id 20 id 21 url 22 otherId: id 23 ... on Article { 24 name 25 text 26 otherName: name 27 } 28 ... on Content { 29 id 30 name 31 otherName: name 32 } 33 ... on HasDuration { duration } 34 } 35 conflictingStuff: randomItem { 36 # These two have different types! Naming gets complicated. Note GraphQL 37 # says [1] that you can only have such naming conflicts when the fields are 38 # both on object-typed spreads (reasonable, so they can never collide) and 39 # they are of "shapes that can be merged", e.g. both nullable objects, 40 # which seems very strange to me but is the most interesting case for us 41 # anyway (since where we could have trouble is naming the result types). 42 # [1] https://spec.graphql.org/draft/#SameResponseShape() 43 # TODO(benkraft): This actually generates the wrong thing right now (the 44 # two thumbnail types get the same name, and one clobbers the other). Fix 45 # in a follow-up commit. 46 ... on Article { thumbnail { id thumbnailUrl } } 47 ... on Video { thumbnail { id timestampSec } } 48 } 49 nestedStuff: randomItem { 50 ... on Topic { 51 children { 52 id 53 ... on Article { 54 text 55 parent { 56 ... on Content { 57 name 58 parent { 59 ... on Topic { 60 children { id name } 61 } 62 } 63 } 64 } 65 } 66 } 67 } 68 } 69 }