@@ -23,6 +23,11 @@ class DefaultValuesTest extends Specification {
23
23
myField2 : df]]
24
24
). build()
25
25
26
+ //
27
+ // The variable is present in the variables map and its explicitly null
28
+ //
29
+ // https://spec.graphql.org/October2021/#sec-Coercing-Variable-Values
30
+ //
26
31
when :
27
32
def ei = newExecutionInput('''
28
33
query myQuery($deleted: Boolean = false) {
@@ -35,6 +40,11 @@ class DefaultValuesTest extends Specification {
35
40
er. errors. isEmpty()
36
41
er. data == [myField : " dataFetcherArg=null" ]
37
42
43
+ //
44
+ // The variable is present in the variables map and its explicitly a value
45
+ //
46
+ // https://spec.graphql.org/October2021/#sec-Coercing-Variable-Values
47
+ //
38
48
when :
39
49
ei = newExecutionInput('''
40
50
query myQuery($deleted: Boolean = false) {
@@ -47,6 +57,12 @@ class DefaultValuesTest extends Specification {
47
57
er. errors. isEmpty()
48
58
er. data == [myField : " dataFetcherArg=true" ]
49
59
60
+ //
61
+ // The variable is NOT present in the variables map it should use a default
62
+ // value from the variable declaration
63
+ //
64
+ // https://spec.graphql.org/October2021/#sec-Coercing-Variable-Values
65
+ //
50
66
when :
51
67
ei = newExecutionInput('''
52
68
query myQuery($deleted: Boolean = false) {
@@ -59,6 +75,11 @@ class DefaultValuesTest extends Specification {
59
75
er. errors. isEmpty()
60
76
er. data == [myField : " dataFetcherArg=false" ]
61
77
78
+ //
79
+ // The variable is NOT present in the variables map and a variable is NOT used
80
+ // it should use a default value from the field declaration
81
+ //
82
+ //
62
83
when :
63
84
ei = newExecutionInput('''
64
85
query myQuery($deleted: Boolean = false) {
@@ -73,6 +94,11 @@ class DefaultValuesTest extends Specification {
73
94
er. data == [myField : " dataFetcherArg=true" ,
74
95
myField2 : " dataFetcherArg=false" ]
75
96
97
+ //
98
+ // If there are no variables on the query operation
99
+ // it should use a default value from the field declaration
100
+ // or literals provided
101
+ //
76
102
when :
77
103
ei = newExecutionInput('''
78
104
query myQuery {
0 commit comments