@@ -10,7 +10,12 @@ the case that any _field error_ was raised on a field and was replaced with
10
10
11
11
## Response Format
12
12
13
- A response to a GraphQL request must be a map.
13
+ A GraphQL request returns either a _ response_ or a _ response stream_ .
14
+
15
+ ### Response
16
+
17
+ :: A GraphQL request returns a _ response_ when the GraphQL operation is a query
18
+ or mutation. A _ response_ must be a map.
14
19
15
20
If the request raised any errors, the response map must contain an entry with
16
21
key ` errors ` . The value of this entry is described in the "Errors" section. If
@@ -35,6 +40,11 @@ Note: When `errors` is present in the response, it may be helpful for it to
35
40
appear first when serialized to make it more clear when errors are present in a
36
41
response during debugging.
37
42
43
+ ### Response Stream
44
+
45
+ :: A GraphQL request returns a _ response stream_ when the GraphQL operation is a
46
+ subscription. A _ response stream_ must be a stream of _ response_ .
47
+
38
48
### Data
39
49
40
50
The ` data ` entry in the response will be the result of the execution of the
@@ -107,14 +117,8 @@ syntax element.
107
117
If an error can be associated to a particular field in the GraphQL result, it
108
118
must contain an entry with the key ` path ` that details the path of the response
109
119
field which experienced the error. This allows clients to identify whether a
110
- ` null ` result is intentional or caused by a runtime error.
111
-
112
- If present, this field must be a list of path segments starting at the root of
113
- the response and ending with the field associated with the error. Path segments
114
- that represent fields must be strings, and path segments that represent list
115
- indices must be 0-indexed integers. If the error happens in an aliased field,
116
- the path to the error must use the aliased name, since it represents a path in
117
- the response, not in the request.
120
+ ` null ` result is intentional or caused by a runtime error. The value of this
121
+ _ path entry_ is described in the [ Path] ( #sec-Path ) section.
118
122
119
123
For example, if fetching one of the friends' names fails in the following
120
124
operation:
@@ -244,6 +248,21 @@ discouraged.
244
248
}
245
249
```
246
250
251
+ ### Path
252
+
253
+ :: A _ path entry_ is an entry within an _ error result_ that allows for
254
+ association with a particular field reached during GraphQL execution.
255
+
256
+ The value for a _ path entry_ must be a list of path segments starting at the
257
+ root of the response and ending with the field to be associated with. Path
258
+ segments that represent fields must be strings, and path segments that represent
259
+ list indices must be 0-indexed integers. If a path segment is associated with an
260
+ aliased field it must use the aliased name, since it represents a path in the
261
+ response, not in the request.
262
+
263
+ When the _ path entry_ is present on an _ error result_ , it identifies the
264
+ response field which experienced the error.
265
+
247
266
## Serialization Format
248
267
249
268
GraphQL does not require a specific serialization format. However, clients
0 commit comments