Skip to content

Commit e9c1ede

Browse files
committed
Minor edits to match spec text
1 parent d019e2e commit e9c1ede

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/validation/rules/VariablesInAllowedPosition.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function VariablesInAllowedPosition(
5858
const varType = typeFromAST(schema, varDef.type);
5959
if (
6060
varType &&
61-
!allowedInPosition(
61+
!allowedVariableUsage(
6262
schema,
6363
varType,
6464
varDef.defaultValue,
@@ -84,26 +84,26 @@ export function VariablesInAllowedPosition(
8484
}
8585

8686
/**
87-
* Returns true if the variable is allowed in the position it was found,
87+
* Returns true if the variable is allowed in the location it was found,
8888
* which includes considering if default values exist for either the variable
8989
* or the location at which it is located.
9090
*/
91-
function allowedInPosition(
91+
function allowedVariableUsage(
9292
schema: GraphQLSchema,
9393
varType: GraphQLType,
9494
varDefaultValue: ?ValueNode,
9595
locationType: GraphQLType,
9696
locationDefaultValue: ?mixed,
9797
): boolean {
9898
if (isNonNullType(locationType) && !isNonNullType(varType)) {
99-
const hasLocationDefaultValue = locationDefaultValue !== undefined;
10099
const hasNonNullVariableDefaultValue =
101100
varDefaultValue && varDefaultValue.kind !== Kind.NULL;
102-
if (!hasLocationDefaultValue && !hasNonNullVariableDefaultValue) {
101+
const hasLocationDefaultValue = locationDefaultValue !== undefined;
102+
if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) {
103103
return false;
104104
}
105-
const locationNullableType = locationType.ofType;
106-
return isTypeSubTypeOf(schema, varType, locationNullableType);
105+
const nullableLocationType = locationType.ofType;
106+
return isTypeSubTypeOf(schema, varType, nullableLocationType);
107107
}
108108
return isTypeSubTypeOf(schema, varType, locationType);
109109
}

0 commit comments

Comments
 (0)