Description
I think the relevant parts of the spec are "6.4.4 Errors and Non-Nullability" and "3.1.7 Lists, result coercion", which in my opinion do not clarify the following:
If a field of type [String]
is queried, and an error occurs during determining the value of the second item, would the result of the field be null
or would it be ["elA", null, "elC"]
?
Section 3.1.7 says
Each item in the list must be the result of a result coercion of the item type. If a reasonable coercion is not possible they must raise a field error.
The question is the "granularity" of the field error and the returned null value: is it constrained to the field as a whole or can it apply to list items?
In the second case, would there be one "field error" listing all single item errors or would there be multiple field errors? Also, in this case the null propagation of section 6.4.4 should be applied: in a [String!]
field, the whole list should be set to null. This would then extend to nested lists: [[String!]]
should return a null item in the outer list.
An argument against the first case is:
Returning null
for the whole field would lose the items that could be determined.
Could please the specification be extended to include a clarification on what GraphQL is expected to do in this case?