Skip to content

Commit 6ca64c6

Browse files
committed
Rename variables to variableValues for clarity
1 parent 31ffe4a commit 6ca64c6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/execution/execute.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type ExecutionContext = {
8181
fragments: {[key: string]: FragmentDefinition};
8282
rootValue: any;
8383
operation: OperationDefinition;
84-
variables: {[key: string]: any};
84+
variableValues: {[key: string]: any};
8585
errors: Array<GraphQLError>;
8686
}
8787

@@ -155,7 +155,7 @@ function buildExecutionContext(
155155
schema: GraphQLSchema,
156156
documentAST: Document,
157157
rootValue: any,
158-
variableValues: ?{[key: string]: any},
158+
rawVariableValues: ?{[key: string]: any},
159159
operationName: ?string
160160
): ExecutionContext {
161161
var errors: Array<GraphQLError> = [];
@@ -181,13 +181,13 @@ function buildExecutionContext(
181181
if (!operation) {
182182
throw new GraphQLError(`Unknown operation named "${opName}".`);
183183
}
184-
var variables = getVariableValues(
184+
var variableValues = getVariableValues(
185185
schema,
186186
operation.variableDefinitions || [],
187-
variableValues || {}
187+
rawVariableValues || {}
188188
);
189189
var exeContext: ExecutionContext =
190-
{ schema, fragments, rootValue, operation, variables, errors };
190+
{ schema, fragments, rootValue, operation, variableValues, errors };
191191
return exeContext;
192192
}
193193

@@ -383,7 +383,7 @@ function shouldIncludeNode(
383383
var { if: skipIf } = getArgumentValues(
384384
GraphQLSkipDirective.args,
385385
skipAST.arguments,
386-
exeContext.variables
386+
exeContext.variableValues
387387
);
388388
return !skipIf;
389389
}
@@ -396,7 +396,7 @@ function shouldIncludeNode(
396396
var { if: includeIf } = getArgumentValues(
397397
GraphQLIncludeDirective.args,
398398
includeAST.arguments,
399-
exeContext.variables
399+
exeContext.variableValues
400400
);
401401
return Boolean(includeIf);
402402
}
@@ -478,7 +478,7 @@ function resolveField(
478478
var args = getArgumentValues(
479479
fieldDef.args,
480480
fieldAST.arguments,
481-
exeContext.variables
481+
exeContext.variableValues
482482
);
483483

484484
// The resolve function's optional third argument is a collection of
@@ -492,7 +492,7 @@ function resolveField(
492492
fragments: exeContext.fragments,
493493
rootValue: exeContext.rootValue,
494494
operation: exeContext.operation,
495-
variables: exeContext.variables,
495+
variableValues: exeContext.variableValues,
496496
};
497497

498498
// If an error occurs while calling the field `resolve` function, ensure that

src/execution/values.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import type { Argument, VariableDefinition } from '../language/ast';
3030

3131

3232
/**
33-
* Prepares an object map of variables of the correct type based on the provided
34-
* variable definitions and arbitrary input. If the input cannot be parsed
35-
* to match the variable definitions, a GraphQLError will be thrown.
33+
* Prepares an object map of variableValues of the correct type based on the
34+
* provided variable definitions and arbitrary input. If the input cannot be
35+
* parsed to match the variable definitions, a GraphQLError will be thrown.
3636
*/
3737
export function getVariableValues(
3838
schema: GraphQLSchema,
@@ -54,7 +54,7 @@ export function getVariableValues(
5454
export function getArgumentValues(
5555
argDefs: ?Array<GraphQLArgument>,
5656
argASTs: ?Array<Argument>,
57-
variables: { [key: string]: any }
57+
variableValues: { [key: string]: any }
5858
): { [key: string]: any } {
5959
if (!argDefs || !argASTs) {
6060
return {};
@@ -63,7 +63,7 @@ export function getArgumentValues(
6363
return argDefs.reduce((result, argDef) => {
6464
var name = argDef.name;
6565
var valueAST = argASTMap[name] ? argASTMap[name].value : null;
66-
var value = valueFromAST(valueAST, argDef.type, variables);
66+
var value = valueFromAST(valueAST, argDef.type, variableValues);
6767
if (isNullish(value)) {
6868
value = argDef.defaultValue;
6969
}

src/type/definition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export type GraphQLResolveInfo = {
365365
fragments: { [fragmentName: string]: FragmentDefinition },
366366
rootValue: any,
367367
operation: OperationDefinition,
368-
variables: { [variableName: string]: any },
368+
variableValues: { [variableName: string]: any },
369369
}
370370

371371
export type GraphQLFieldConfig = {

0 commit comments

Comments
 (0)