You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ExecutionInput ei =ExecutionInput.newExecutionInput(query).root(
31
+
[foo: null]
32
+
).build()
33
+
34
+
def er = graphql.execute(ei)
35
+
36
+
then:
37
+
er.data !=null
38
+
er.data.foo ==null
39
+
er.errors[0].path.toList() == ["foo"]
40
+
}
41
+
42
+
def"without experimental_disableErrorPropagation, error is propagated"() {
43
+
44
+
def sdl ='''
45
+
type Query {
46
+
foo : Int!
47
+
}
48
+
directive @experimental_disableErrorPropagation on QUERY | MUTATION | SUBSCRIPTION
49
+
'''
50
+
51
+
def graphql =TestUtil.graphQL(sdl).build()
52
+
53
+
def query ='''
54
+
query GetFoo { foo }
55
+
'''
56
+
when:
57
+
58
+
ExecutionInput ei =ExecutionInput.newExecutionInput(query).root(
59
+
[foo: null]
60
+
).build()
61
+
62
+
def er = graphql.execute(ei)
63
+
64
+
then:
65
+
er.data ==null
66
+
er.errors[0].message =="The field at path '/foo' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'Int' within parent type 'Query'"
67
+
er.errors[0].path.toList() == ["foo"]
68
+
}
69
+
70
+
def"With experimental_disableErrorPropagation JVM disabled, error is propagated"() {
71
+
def sdl ='''
72
+
type Query {
73
+
foo : Int!
74
+
}
75
+
directive @experimental_disableErrorPropagation on QUERY | MUTATION | SUBSCRIPTION
ExecutionInput ei =ExecutionInput.newExecutionInput(query).root(
88
+
[foo: null]
89
+
).build()
90
+
91
+
def er = graphql.execute(ei)
92
+
93
+
then:
94
+
er.data ==null
95
+
er.errors[0].message =="The field at path '/foo' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'Int' within parent type 'Query'"
96
+
er.errors[0].path.toList() == ["foo"]
97
+
}
98
+
99
+
def"when @experimental_disableErrorPropagation is not added to the schema operation is gets added by schema code"() {
0 commit comments