Skip to content

Commit

Permalink
Add comments about fragments that don't apply
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminjkraft committed Aug 28, 2021
1 parent ae5c33d commit 28d7420
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generate/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ func (g *generator) convertSelectionSet(
case *ast.FragmentSpread:
return nil, errorf(selection.Position, "not implemented: %T", selection)
case *ast.InlineFragment:
// (Note this will return nil, nil if the fragment doesn't apply to
// this type.)
fragmentFields, err := g.convertInlineFragment(
namePrefix, selection, containingTypedef, queryOptions)
if err != nil {
Expand Down Expand Up @@ -448,7 +450,8 @@ func fragmentMatches(containingTypedef, fragmentTypedef *ast.Definition) bool {
// containingTypedef is the type-def corresponding to the type into which we
// are spreading; it may be either an interface type (when spreading into one)
// or an object type (when writing the implementations of such an interface, or
// when using an inline fragment in an object type which is rare).
// when using an inline fragment in an object type which is rare). If the
// given fragment does not apply to that type, this function returns nil, nil.
//
// In general, we treat such fragments' fields as if they were fields of the
// parent selection-set (except of course they are only included in types the
Expand Down

0 comments on commit 28d7420

Please sign in to comment.