Abstract Spreads in Object Scope

In scope of an object type, unions or interface spreads can be used if the object type implements the interface or is a member of the union.

For example

fragment petNameFragment on Pet {
  name
}

fragment interfaceWithinObjectFragment on Dog {
  ...petNameFragment
}

is valid becauseDogimplements Pet.

Likewise

fragment catOrDogNameFragment on CatOrDog {
  ... on Cat {
    meowVolume
  }
}

fragment unionWithObjectFragment on Dog {
  ...catOrDogNameFragment
}

is valid becauseDogis a member of theCatOrDogunion. It is worth noting that if one inspected the contents of theCatOrDogNameFragmentyou could note that no valid results would ever be returned. However we do not specify this as invalid because we only consider the fragment declaration, not its body.

results matching ""

    No results matching ""