Skip to content

Commit 792671b

Browse files
benjieleebyron
andauthored
__Type represents all types in the system (#775)
* __Type represents all types in the system * Named types * Clarify __Type * Minor edit to combine paragraphs and rephrase * Further clarification * Include similar clarification in the type modifiers Co-authored-by: Lee Byron <[email protected]>
1 parent d616285 commit 792671b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

spec/Section 4 -- Introspection.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ enum __DirectiveLocation {
217217

218218
### The __Type Type
219219

220-
`__Type` is at the core of the type introspection system.
221-
It represents scalars, interfaces, object types, unions, enums, input objects types in the system.
222-
223-
`__Type` also represents type modifiers, which are used to modify a type
224-
that it refers to (`ofType: __Type`). This is how we represent lists,
225-
non-nullable types, and the combinations thereof.
220+
`__Type` is at the core of the type introspection system, it represents all
221+
types in the system: both named types (e.g. Scalars and Object types) and
222+
type modifiers (e.g. List and Non-Null types).
226223

224+
Type modifiers are used to modify the type presented in the field `ofType`.
225+
This modified type may recursively be a modified type, representing lists,
226+
non-nullables, and combinations thereof, ultimately modifying a named type.
227227

228228
### Type Kinds
229229

@@ -346,6 +346,9 @@ Lists represent sequences of values in GraphQL. A List type is a type modifier:
346346
it wraps another type instance in the `ofType` field, which defines the type of
347347
each item in the list.
348348

349+
The modified type in the `ofType` field may itself be a modified type, allowing
350+
the representation of Lists of Lists, or Lists of Non-Nulls.
351+
349352
Fields
350353

351354
* `kind` must return `__TypeKind.LIST`.
@@ -357,12 +360,16 @@ Fields
357360

358361
GraphQL types are nullable. The value {null} is a valid response for field type.
359362

360-
A Non-null type is a type modifier: it wraps another type instance in the
363+
A Non-Null type is a type modifier: it wraps another type instance in the
361364
`ofType` field. Non-null types do not allow {null} as a response, and indicate
362365
required inputs for arguments and input object fields.
363366

367+
The modified type in the `ofType` field may itself be a modified List type,
368+
allowing the representation of Non-Null of Lists. However it must not be a
369+
modified Non-Null type to avoid a redundant Non-Null of Non-Null.
370+
364371
* `kind` must return `__TypeKind.NON_NULL`.
365-
* `ofType`: Any type except Non-null.
372+
* `ofType`: Any type except Non-Null.
366373
* All other fields must return {null}.
367374

368375

0 commit comments

Comments
 (0)