From 9987cc9db1163a609da903503c35450a96cbf151 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Fri, 4 Jun 2021 09:45:32 +0300 Subject: [PATCH 1/3] rename resolveField function to match spec --- src/execution/execute.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 5d7f25e722..8608feb6c8 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -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, @@ -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, @@ -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, From d2366119b8c40755b2893b05a404aac7d8d8c318 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Fri, 4 Jun 2021 09:55:18 +0300 Subject: [PATCH 2/3] Latest draft of spec has sections titled "Executing..." not "Evaluating..." --- src/execution/execute.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 8608feb6c8..40961abc4b 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -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 @@ -196,7 +196,7 @@ export function execute(args: ExecutionArgs): PromiseOrValue { } /** - * 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. */ @@ -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, @@ -367,7 +367,7 @@ function executeOperation( } /** - * Implements the "Evaluating selection sets" section of the spec + * Implements the "Executing selection sets" section of the spec * for "write" mode. */ function executeFieldsSerially( @@ -405,7 +405,7 @@ function executeFieldsSerially( } /** - * Implements the "Evaluating selection sets" section of the spec + * Implements the "Executing selection sets" section of the spec * for "read" mode. */ function executeFields( @@ -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, From 480dca9806b707c41e47006dca222c81689bfeea Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Fri, 4 Jun 2021 09:57:15 +0300 Subject: [PATCH 3/3] remove references to read/write modes spec does not have read/write modes. although write is a reference to mutations, seems proper to not introduce new concepts within the code --- src/execution/execute.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/execution/execute.ts b/src/execution/execute.ts index 40961abc4b..4b30409f98 100644 --- a/src/execution/execute.ts +++ b/src/execution/execute.ts @@ -368,7 +368,7 @@ function executeOperation( /** * Implements the "Executing selection sets" section of the spec - * for "write" mode. + * for fields that must be executed serially. */ function executeFieldsSerially( exeContext: ExecutionContext, @@ -406,7 +406,7 @@ function executeFieldsSerially( /** * Implements the "Executing selection sets" section of the spec - * for "read" mode. + * for fields that may be executed in parallel. */ function executeFields( exeContext: ExecutionContext,