@@ -61,21 +61,30 @@ export function getArgumentValues(
6161
6262 if ( valueNode . kind === Kind . VARIABLE ) {
6363 const variableName = valueNode . name . value ;
64- if ( variableValues == null || ! hasOwnProperty ( variableValues , variableName ) ) {
65- if ( defaultValue !== undefined ) {
64+ if ( fragmentArgValues != null && hasOwnProperty ( fragmentArgValues , variableName ) ) {
65+ isNull = fragmentArgValues [ variableName ] == null ;
66+ if ( isNull && defaultValue !== undefined ) {
6667 coercedValues [ name ] = defaultValue ;
67- } else if ( isNonNullType ( argType ) ) {
68- throw createGraphQLError (
69- `Argument "${ name } " of required type "${ inspect ( argType ) } " ` +
70- `was provided the variable "$${ variableName } " which was not provided a runtime value.` ,
71- {
72- nodes : [ valueNode ] ,
73- } ,
74- ) ;
68+ continue ;
7569 }
70+ } else if ( variableValues != null && hasOwnProperty ( variableValues , variableName ) ) {
71+ isNull = variableValues [ variableName ] == null ;
72+ if ( isNull && defaultValue !== undefined ) {
73+ coercedValues [ name ] = defaultValue ;
74+ continue ;
75+ }
76+ } else if ( defaultValue !== undefined ) {
77+ coercedValues [ name ] = defaultValue ;
78+ continue ;
79+ } else if ( isNonNullType ( argType ) ) {
80+ throw createGraphQLError (
81+ `Argument "${ name } " of required type "${ inspect ( argType ) } " ` +
82+ `was provided the variable "$${ variableName } " which was not provided a runtime value.` ,
83+ { nodes : valueNode } ,
84+ ) ;
85+ } else {
7686 continue ;
7787 }
78- isNull = variableValues [ variableName ] == null ;
7988 }
8089
8190 if ( isNull && isNonNullType ( argType ) ) {
@@ -87,7 +96,10 @@ export function getArgumentValues(
8796 ) ;
8897 }
8998
90- const coercedValue = valueFromAST ( valueNode , argType , variableValues ) ;
99+ const coercedValue = valueFromAST ( valueNode , argType , {
100+ ...variableValues ,
101+ ...fragmentArgValues ,
102+ } ) ;
91103 if ( coercedValue === undefined ) {
92104 // Note: ValuesOfCorrectTypeRule validation should catch this before
93105 // execution. This is a runtime check to ensure execution does not
0 commit comments