Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute: Rename resolveField function and update comments #3159

Merged
merged 3 commits into from Jun 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/execution/execute.ts
Expand Up @@ -142,7 +142,7 @@ export interface ExecutionArgs {
}

/**
* Implements the "Evaluating requests" section of the GraphQL specification.
* Implements the "Executing requests" section of the GraphQL specification.
*
* Returns either a synchronous ExecutionResult (if all encountered resolvers
* are synchronous), or a Promise of an ExecutionResult that will eventually be
Expand Down Expand Up @@ -196,7 +196,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
}

/**
* Also implements the "Evaluating requests" section of the GraphQL specification.
* Also implements the "Executing requests" section of the GraphQL specification.
* However, it guarantees to complete synchronously (or throw an error) assuming
* that all field resolvers are also synchronous.
*/
Expand Down Expand Up @@ -327,7 +327,7 @@ export function buildExecutionContext(
}

/**
* Implements the "Evaluating operations" section of the spec.
* Implements the "Executing operations" section of the spec.
*/
function executeOperation(
exeContext: ExecutionContext,
Expand Down Expand Up @@ -367,8 +367,8 @@ function executeOperation(
}

/**
* Implements the "Evaluating selection sets" section of the spec
* for "write" mode.
* Implements the "Executing selection sets" section of the spec
* for fields that must be executed serially.
*/
function executeFieldsSerially(
exeContext: ExecutionContext,
Expand All @@ -381,7 +381,7 @@ function executeFieldsSerially(
fields.entries(),
(results, [responseName, fieldNodes]) => {
const fieldPath = addPath(path, responseName, parentType.name);
const result = resolveField(
const result = executeField(
exeContext,
parentType,
sourceValue,
Expand All @@ -405,8 +405,8 @@ function executeFieldsSerially(
}

/**
* Implements the "Evaluating selection sets" section of the spec
* for "read" mode.
* Implements the "Executing selection sets" section of the spec
* for fields that may be executed in parallel.
*/
function executeFields(
exeContext: ExecutionContext,
Expand All @@ -420,7 +420,7 @@ function executeFields(

for (const [responseName, fieldNodes] of fields.entries()) {
const fieldPath = addPath(path, responseName, parentType.name);
const result = resolveField(
const result = executeField(
exeContext,
parentType,
sourceValue,
Expand Down Expand Up @@ -583,12 +583,12 @@ function getFieldEntryKey(node: FieldNode): string {
}

/**
* Resolves the field on the given source object. In particular, this
* figures out the value that the field returns by calling its resolve function,
* then calls completeValue to complete promises, serialize scalars, or execute
* the sub-selection-set for objects.
* Implements the "Executing field" section of the spec
* In particular, this function figures out the value that the field returns by
* calling its resolve function, then calls completeValue to complete promises,
* serialize scalars, or execute the sub-selection-set for objects.
*/
function resolveField(
function executeField(
exeContext: ExecutionContext,
parentType: GraphQLObjectType,
source: unknown,
Expand Down Expand Up @@ -722,7 +722,7 @@ function handleFieldError(
* and then complete based on that type
*
* Otherwise, the field type expects a sub-selection set, and will complete the
* value by evaluating all sub-selections.
* value by executing all sub-selections.
*/
function completeValue(
exeContext: ExecutionContext,
Expand Down