Skip to content

__Type represents all types in the system #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions spec/Section 4 -- Introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ enum __DirectiveLocation {

### The __Type Type

`__Type` is at the core of the type introspection system.
It represents scalars, interfaces, object types, unions, enums, input objects types in the system.

`__Type` also represents type modifiers, which are used to modify a type
that it refers to (`ofType: __Type`). This is how we represent lists,
non-nullable types, and the combinations thereof.
`__Type` is at the core of the type introspection system, it represents all
types in the system: both named types (e.g. Scalars and Object types) and
type modifiers (e.g. List and Non-Null types).

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

### Type Kinds

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

The modified type in the `ofType` field may itself be a modified type, allowing
the representation of Lists of Lists, or Lists of Non-Nulls.

Fields

* `kind` must return `__TypeKind.LIST`.
Expand All @@ -356,12 +359,16 @@ Fields

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

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

The modified type in the `ofType` field may itself be a modified List type,
allowing the representation of Non-Null of Lists. However it must not be a
modified Non-Null type to avoid a redundant Non-Null of Non-Null.

* `kind` must return `__TypeKind.NON_NULL`.
* `ofType`: Any type except Non-null.
* `ofType`: Any type except Non-Null.
* All other fields must return {null}.


Expand Down