Skip to content

Commit 04e2431

Browse files
committed
RFC: Adds "coordinate" to errors
1 parent 96271da commit 04e2431

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

spec/Section 7 -- Response.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ describes the _response position_ which raised the error. This allows clients to
193193
identify whether a {null} resolved result is a true value or the result of an
194194
_execution error_.
195195

196+
If an error can be associated to a particular object field or field argument, it should contain an
197+
entry with the key {"coordinate"} with a string value that is the _schema coordinate_ of that object
198+
field or field argument. This allows clients to identify the precise location in the schema where
199+
the error originated.
200+
196201
For example, if fetching one of the friends' names fails in the following
197202
operation:
198203

@@ -216,7 +221,8 @@ The response might look like:
216221
{
217222
"message": "Name for character with ID 1002 could not be fetched.",
218223
"locations": [{ "line": 6, "column": 7 }],
219-
"path": ["hero", "heroFriends", 1, "name"]
224+
"path": ["hero", "heroFriends", 1, "name"],
225+
"coordinate": "Human.name"
220226
}
221227
],
222228
"data": {
@@ -256,7 +262,8 @@ be the same:
256262
{
257263
"message": "Name for character with ID 1002 could not be fetched.",
258264
"locations": [{ "line": 6, "column": 7 }],
259-
"path": ["hero", "heroFriends", 1, "name"]
265+
"path": ["hero", "heroFriends", 1, "name"],
266+
"coordinate": "Human.name"
260267
}
261268
],
262269
"data": {
@@ -290,6 +297,7 @@ see fit, and there are no additional restrictions on its contents.
290297
"message": "Name for character with ID 1002 could not be fetched.",
291298
"locations": [{ "line": 6, "column": 7 }],
292299
"path": ["hero", "heroFriends", 1, "name"],
300+
"coordinate": "Human.name",
293301
"extensions": {
294302
"code": "CAN_NOT_FETCH_BY_ID",
295303
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
@@ -314,6 +322,7 @@ discouraged.
314322
"message": "Name for character with ID 1002 could not be fetched.",
315323
"locations": [{ "line": 6, "column": 7 }],
316324
"path": ["hero", "heroFriends", 1, "name"],
325+
"coordinate": "Human.name",
317326
"code": "CAN_NOT_FETCH_BY_ID",
318327
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
319328
}

0 commit comments

Comments
 (0)