Skip to content

Commit 8a97138

Browse files
committed
add spec updates
1 parent 258d841 commit 8a97138

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

spec/Section 3 -- Type System.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ _schema element_ within a GraphQL Schema.
21852185
:: A _schema element_ can be a named type, a field, an input field, an enum
21862186
value, a field argument, a directive, or a directive argument.
21872187

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
21892189
by exactly one possible schema coordinate.
21902190

21912191
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
22052205
used in logging tools to track how often particular fields are queried in
22062206
production.
22072207

2208-
**Semantics**
2208+
**Resolving a Schema Coordinate**
22092209

22102210
To refer to a _schema element_, a _schema coordinate_ must be interpreted in the
22112211
context of a GraphQL {schema}.
22122212

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+
22132218
SchemaCoordinate : Name
22142219

22152220
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}
22172224

22182225
SchemaCoordinate : Name . Name
22192226

22202227
1. Let {typeName} be the value of the first {Name}.
22212228
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}
22322246

22332247
SchemaCoordinate : Name . Name ( Name : )
22342248

@@ -2239,20 +2253,27 @@ SchemaCoordinate : Name . Name ( Name : )
22392253
5. Let {field} be the field of {type} named {fieldName}.
22402254
6. Assert {field} must exist.
22412255
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}.
22432259

22442260
SchemaCoordinate : @ Name
22452261

22462262
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}.
22482266

22492267
SchemaCoordinate : @ Name ( Name : )
22502268

22512269
1. Let {directiveName} be the value of the first {Name}.
22522270
2. Let {directive} be the directive in the {schema} named {directiveName}.
22532271
3. Assert {directive} must exist.
22542272
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}.
22562277

22572278
**Examples**
22582279

0 commit comments

Comments
 (0)