Skip to content

[Schema] Implementing interfaces with covariant return types. #123

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 1 commit into from
Nov 17, 2015
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
16 changes: 14 additions & 2 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,20 @@ of rules must be adhered to by every Object type in a GraphQL schema.
2. An object type must be a super-set of all interfaces it implements.
1. The object type must include a field of the same name for every field
defined in an interface.
1. The object field must be of a type which is equal to the
interface field (invariant).
1. The object field must be of a type which is equal to or a sub-type of
the interface field (covariant).
1. An object field type is a valid sub-type if it is equal to (the same
type as) the interface field type.
2. An object field type is a valid sub-type if it is an Object type and
the interface field type is either an Interface type or a Union type
and the object field type is a possible type of the interface field
type.
3. An object field type is a valid sub-type if it is a List type and
the interface field type is also a List type and the list-item type
of the object field type is a valid sub-type of the list-item type
of the interface field type.
4. An object field type is a valid sub-type if it is a Non-Null variant
of a valid sub-type of the interface field type.
2. The object field must include an argument of the same name for every
argument defined in the interface field.
1. The object field argument must accept the same type (invariant) as
Expand Down