Skip to content

Commit fbbd271

Browse files
committed
Add note about meta-fields
1 parent 3e4bdf8 commit fbbd271

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

spec/Section 3 -- Type System.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,34 @@ DirectiveArgumentCoordinate : @ Name ( Name : )
23362336
5. Return the argument of {directive} named {directiveArgumentName} if it
23372337
exists.
23382338

2339+
**Resolving Meta-fields**
2340+
2341+
Resolving the _schema coordinate_ of a meta-field is undefined behaviour, since
2342+
these fields may be implemented in such a way that makes it impossible to return
2343+
a unique value specific to that instance of the meta-field.
2344+
2345+
Therefore, it is left up to the implementation to decide whether or not to
2346+
return a value for a meta-field. If a value is returned, it must meet the
2347+
requirement that it is unique to that _schema coordinate_.
2348+
2349+
**Result Coercion and Serialization**
2350+
2351+
A GraphQL service, when preparing a field of a given scalar type, must uphold
2352+
the contract the scalar type describes, either by coercing the value or
2353+
producing an _execution error_ if a value cannot be coerced or if coercion may
2354+
result in data loss.
2355+
2356+
A GraphQL service may decide to allow coercing different internal types to the
2357+
expected return type. For example when coercing a field of type {Int} a boolean
2358+
{true} value may produce {1} or a string value {"123"} may be parsed as base-10
2359+
{123}. However if internal type coercion cannot be reasonably performed without
2360+
losing information, then it must raise an _execution error_.
2361+
2362+
Since this coercion behavior is not observable to clients of the GraphQL
2363+
service, the precise rules of coercion are left to the implementation. The only
2364+
requirement is that the service must yield values which adhere to the expected
2365+
Scalar type.
2366+
23392367
**Examples**
23402368

23412369
| Element Kind | _Schema Coordinate_ | _Schema Element_ |

0 commit comments

Comments
 (0)