MCPcopy
hub / github.com/graphql/graphql-js / FragmentSpread

Function FragmentSpread

src/validation/rules/PossibleFragmentSpreadsRule.ts:86–104  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

84 }
85 },
86 FragmentSpread(node) {
87 const fragName = node.name.value;
88 const fragType = getFragmentType(context, fragName);
89 const parentType = context.getParentType();
90 if (
91 fragType &&
92 parentType &&
93 !doTypesOverlap(context.getSchema(), fragType, parentType)
94 ) {
95 const parentTypeStr = inspect(parentType);
96 const fragTypeStr = inspect(fragType);
97 context.reportError(
98 new GraphQLError(
99 `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`,
100 { nodes: node },
101 ),
102 );
103 }
104 },
105 };
106}
107

Callers

nothing calls this directly

Calls 6

doTypesOverlapFunction · 0.90
inspectFunction · 0.90
getFragmentTypeFunction · 0.85
getParentTypeMethod · 0.45
getSchemaMethod · 0.45
reportErrorMethod · 0.45

Tested by

no test coverage detected