MCPcopy Create free account
hub / github.com/openai/plugins / Field

Function Field

plugins/shopify/skills/shopify-partner/scripts/validate.mjs:7387–7413  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

7385 function FieldsOnCorrectTypeRule(context) {
7386 return {
7387 Field(node) {
7388 const type = context.getParentType();
7389 if (type) {
7390 const fieldDef = context.getFieldDef();
7391 if (!fieldDef) {
7392 const schema = context.getSchema();
7393 const fieldName = node.name.value;
7394 let suggestion = (0, _didYouMean.didYouMean)(
7395 "to use an inline fragment on",
7396 getSuggestedTypeNames(schema, type, fieldName)
7397 );
7398 if (suggestion === "") {
7399 suggestion = (0, _didYouMean.didYouMean)(
7400 getSuggestedFieldNames(type, fieldName)
7401 );
7402 }
7403 context.reportError(
7404 new _GraphQLError.GraphQLError(
7405 `Cannot query field "${fieldName}" on type "${type.name}".` + suggestion,
7406 {
7407 nodes: node
7408 }
7409 )
7410 );
7411 }
7412 }
7413 }
7414 };
7415 }
7416 function getSuggestedTypeNames(schema, type, fieldName) {

Callers

nothing calls this directly

Calls 8

getSuggestedTypeNamesFunction · 0.70
getSuggestedFieldNamesFunction · 0.70
checkDepthFunction · 0.70
getParentTypeMethod · 0.45
getFieldDefMethod · 0.45
getSchemaMethod · 0.45
reportErrorMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected