MCPcopy
hub / github.com/ardatan/graphql-tools / defaultFieldResolver

Function defaultFieldResolver

packages/executor/src/execution/execute.ts:1559–1573  ·  view source on GitHub ↗
(
  source: any,
  args,
  contextValue,
  info,
)

Source from the content-addressed store, hash-verified

1557 * of calling that function while passing along args and context value.
1558 */
1559export const defaultFieldResolver: GraphQLFieldResolver<unknown, unknown> = function (
1560 source: any,
1561 args,
1562 contextValue,
1563 info,
1564) {
1565 // ensure source is a value for which property access is acceptable.
1566 if (isObjectLike(source) || typeof source === 'function') {
1567 const property = source[info.fieldName];
1568 if (typeof property === 'function') {
1569 return source[info.fieldName](args, contextValue, info);
1570 }
1571 return property;
1572 }
1573};
1574
1575/**
1576 * Implements the "Subscribe" algorithm described in the GraphQL specification,

Callers 2

mockResolverFunction · 0.85
chainResolversFunction · 0.85

Calls 1

isObjectLikeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…