Skip to content

Commit

Permalink
Clarify types of errors in spec text
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Nov 21, 2017
1 parent 951971b commit fb19a8d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
16 changes: 8 additions & 8 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ a server must not include a type called `Int` and use it to represent

A GraphQL server, when preparing a field of a given scalar type, must uphold the
contract the scalar type describes, either by coercing the value or
producing an error.
producing a field error.

For example, a GraphQL server could be preparing a field with the scalar type
`Int` and encounter a floating-point number. Since the server must not break the
Expand Down Expand Up @@ -805,13 +805,13 @@ An input object is never a valid result.
**Input Coercion**

The value for an input object should be an input object literal or an unordered
map, otherwise an error should be thrown. This unordered map should not contain
map, otherwise a query error should be thrown. This unordered map should not contain
any entries with names not defined by a field of this input object type,
otherwise an error should be thrown.
otherwise a query error should be thrown.

If any non-nullable fields defined by the input object do not have corresponding
entries in the original value, were provided a variable for which a value was
not provided, or for which the value {null} was provided, an error should
not provided, or for which the value {null} was provided, a query error should
be thrown.

The result of coercion is an environment-specific unordered map defining slots
Expand Down Expand Up @@ -840,12 +840,12 @@ Original Value | Variables | Coerced Value
----------------------- | --------------- | -----------------------------------
`{ a: "abc", b: 123 }` | {null} | `{ a: "abc", b: 123 }`
`{ a: 123, b: "123" }` | {null} | `{ a: "123", b: 123 }`
`{ a: "abc" }` | {null} | Error: Missing required field {b}
`{ a: "abc", b: null }` | {null} | Error: {b} must be non-null.
`{ a: "abc" }` | {null} | Query error: Missing required field {b}
`{ a: "abc", b: null }` | {null} | Query error: {b} must be non-null.
`{ a: null, b: 1 }` | {null} | `{ a: null, b: 1 }`
`{ b: $var }` | `{ var: 123 }` | `{ b: 123 }`
`{ b: $var }` | `{}` | Error: Missing required field {b}.
`{ b: $var }` | `{ var: null }` | Error: {b} must be non-null.
`{ b: $var }` | `{}` | Query error: Missing required field {b}.
`{ b: $var }` | `{ var: null }` | Query error: {b} must be non-null.
`{ a: $var, b: 1 }` | `{ var: null }` | `{ a: null, b: 1 }`
`{ a: $var, b: 1 }` | `{}` | `{ b: 1 }`

Expand Down
2 changes: 1 addition & 1 deletion spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ referenced.

Named fragment spreads must refer to fragments defined
within the document. If the target of a spread is
not defined, this is an error:
not defined, this is a validation error:

```graphql counter-example
{
Expand Down
5 changes: 3 additions & 2 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,5 +698,6 @@ resolves to {null}, then the entire list must resolve to {null}.
If the `List` type is also wrapped in a `Non-Null`, the field error continues
to propagate upwards.

If all fields from the root of the request to the source of the error return
`Non-Null` types, then the {"data"} entry in the response should be {null}.
If all fields from the root of the request to the source of the field error
return `Non-Null` types, then the {"data"} entry in the response should
be {null}.
2 changes: 1 addition & 1 deletion spec/Section 7 -- Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ operation if successful, and describes any errors encountered during the
request.

A response may contain both a partial response as well as encountered errors in
the case that an error occurred on a field which was replaced with null.
the case that a field error occurred on a field which was replaced with null.


## Serialization Format
Expand Down

0 comments on commit fb19a8d

Please sign in to comment.