@@ -2185,7 +2185,7 @@ _schema element_ within a GraphQL Schema.
2185
2185
:: A _schema element_ can be a named type , a field , an input field , an enum
2186
2186
value , a field argument , a directive , or a directive argument .
2187
2187
2188
- A _schema coordinate_ is always unique . Each _schema element_ may be referenced
2188
+ A _schema coordinate_ is always unique . Each _schema element_ can be referenced
2189
2189
by exactly one possible schema coordinate .
2190
2190
2191
2191
A _schema coordinate_ may refer to either a defined or built -in _schema
@@ -2205,30 +2205,44 @@ documentation to refer to types and fields in a schema, a lookup key that can be
2205
2205
used in logging tools to track how often particular fields are queried in
2206
2206
production .
2207
2207
2208
- **Semantics **
2208
+ **Resolving a Schema Coordinate **
2209
2209
2210
2210
To refer to a _schema element_ , a _schema coordinate_ must be interpreted in the
2211
2211
context of a GraphQL {schema }.
2212
2212
2213
+ Note : If the _schema element_ cannot be found , the resolve function will not
2214
+ yield a value (without raising an error). However , an error **will ** be raised
2215
+ if any non -leaf nodes within a _schema coordinate_ cannot be found in the
2216
+ {schema }.
2217
+
2213
2218
SchemaCoordinate : Name
2214
2219
2215
2220
1. Let {typeName } be the value of the first {Name }.
2216
- 2. Return the type in the {schema } named {typeName }.
2221
+ 2. Let {type } be the type in the {schema } named {typeName }.
2222
+ 3. If {type } does not exist , return {void }.
2223
+ 4. Return {type }
2217
2224
2218
2225
SchemaCoordinate : Name . Name
2219
2226
2220
2227
1. Let {typeName } be the value of the first {Name }.
2221
2228
2. Let {type } be the type in the {schema } named {typeName }.
2222
- 3. If {type } is an Enum type :
2223
- 4. Let {enumValueName } be the value of the second {Name }.
2224
- 5. Return the enum value of {type } named {enumValueName }.
2225
- 6. Otherwise if {type } is an Input Object type :
2226
- 7. Let {inputFieldName } be the value of the second {Name }.
2227
- 8. Return the input field of {type } named {inputFieldName }.
2228
- 9. Otherwise :
2229
- 10. Assert {type } must be an Object or Interface type .
2230
- 11. Let {fieldName } be the value of the second {Name }.
2231
- 12. Return the field of {type } named {fieldName }.
2229
+ 3. Assert that {type } exists .
2230
+ 4. If {type } is an Enum type :
2231
+ 5. Let {enumValueName } be the value of the second {Name }.
2232
+ 6. Let {enumValue } be the enum value of {type } named {enumValueName }.
2233
+ 7. If {enumValue } does not exist , return {void }.
2234
+ 8. Return {enumValue }
2235
+ 9. Otherwise if {type } is an Input Object type :
2236
+ 10. Let {inputFieldName } be the value of the second {Name }.
2237
+ 11. Let {inputField } be the input field of {type } named {inputFieldName }.
2238
+ 12. If {inputField } does not exist , return {void }.
2239
+ 13. Return {inputField }
2240
+ 14. Otherwise :
2241
+ 15. Assert {type } must be an Object or Interface type .
2242
+ 16. Let {fieldName } be the value of the second {Name }.
2243
+ 17. Let {field } be the field of {type } named {fieldName }.
2244
+ 18. If {field } does not exist , return {void }.
2245
+ 19. Return {field }
2232
2246
2233
2247
SchemaCoordinate : Name . Name ( Name : )
2234
2248
@@ -2239,20 +2253,27 @@ SchemaCoordinate : Name . Name ( Name : )
2239
2253
5. Let {field } be the field of {type } named {fieldName }.
2240
2254
6. Assert {field } must exist .
2241
2255
7. Let {fieldArgumentName } be the value of the third {Name }.
2242
- 8. Return the argument of {field } named {fieldArgumentName }.
2256
+ 8. Let {fieldArgument } be the argument of {field } named {fieldArgumentName }.
2257
+ 9. If {fieldArgument } does not exist , return {void }.
2258
+ 10. Return {fieldArgument }.
2243
2259
2244
2260
SchemaCoordinate : @ Name
2245
2261
2246
2262
1. Let {directiveName } be the value of the first {Name }.
2247
- 2. Return the directive in the {schema } named {directiveName }.
2263
+ 2. Let {directive } be the directive in the {schema } named {directiveName }.
2264
+ 3. If {directive } does not exist , return {void }.
2265
+ 4. Return {directive }.
2248
2266
2249
2267
SchemaCoordinate : @ Name ( Name : )
2250
2268
2251
2269
1. Let {directiveName } be the value of the first {Name }.
2252
2270
2. Let {directive } be the directive in the {schema } named {directiveName }.
2253
2271
3. Assert {directive } must exist .
2254
2272
4. Let {directiveArgumentName } be the value of the second {Name }.
2255
- 5. Return the argument of {directive } named {directiveArgumentName }.
2273
+ 5. Let {directiveArgument } be the argument of {directive } named
2274
+ {directiveArgumentName }.
2275
+ 6. If {directiveArgument } does not exist , return {void }.
2276
+ 7. Return {directiveArgument }.
2256
2277
2257
2278
**Examples **
2258
2279
0 commit comments