@@ -249,9 +249,10 @@ type in the system, allowing the definition of arbitrary type hierarchies.
249249
250250GraphQL supports two abstract types: interfaces and unions.
251251
252- An ` Interface ` defines a list of fields; ` Object ` types that implement that
253- interface are guaranteed to implement those fields. Whenever the type system
254- claims it will return an interface, it will return a valid implementing type.
252+ An ` Interface ` defines a list of fields; ` Object ` types and other Interface
253+ types that implement the interface are guaranteed to implement those fields.
254+ Whenever the type system claims it will return an interface, it will return a
255+ valid implementing ` Object ` type.
255256
256257A ` Union ` defines a list of possible types; similar to interfaces, whenever the
257258type system claims a union will be returned, one of the possible types will be
@@ -804,8 +805,8 @@ of rules must be adhered to by every Object type in a GraphQL schema.
804805 characters {"__ "} (two underscores).
805806 2 . The argument must accept a type where {IsInputType(argumentType)}
806807 returns {true}.
807- 4 . An object type may declare that it implements one or more unique interfaces.
808- 5 . An object type must be a super-set of all interfaces it implements:
808+ 3 . An object type may declare that it implements one or more unique interfaces.
809+ 4 . An object type must be a super-set of all interfaces it implements:
809810 1 . The object type must include a field of the same name for every field
810811 defined in an interface.
811812 1 . The object field must be of a type which is equal to or a sub-type of
@@ -816,11 +817,15 @@ of rules must be adhered to by every Object type in a GraphQL schema.
816817 the interface field type is either an Interface type or a Union type
817818 and the object field type is a possible type of the interface field
818819 type.
819- 3 . An object field type is a valid sub-type if it is a List type and
820+ 3 . An object field type is a valid sub-type if it is an Interface type
821+ and the interface field type is either an Interface type or a Union
822+ type and the object field type is a possible type of the interface
823+ field type.
824+ 4 . An object field type is a valid sub-type if it is a List type and
820825 the interface field type is also a List type and the list-item type
821826 of the object field type is a valid sub-type of the list-item type
822827 of the interface field type.
823- 4 . An object field type is a valid sub-type if it is a Non-Null variant
828+ 5 . An object field type is a valid sub-type if it is a Non-Null variant
824829 of a valid sub-type of the interface field type.
825830 2 . The object field must include an argument of the same name for every
826831 argument defined in the interface field.
@@ -947,8 +952,8 @@ Object type extensions have the potential to be invalid if incorrectly defined.
947952InterfaceTypeDefinition : Description ? interface Name Directives [Const ]? FieldsDefinition ?
948953
949954GraphQL interfaces represent a list of named fields and their arguments . GraphQL
950- objects can then implement these interfaces which requires that the object type
951- will define all fields defined by those interfaces .
955+ objects and interfaces can then implement these interfaces which requires that
956+ the object type will define all fields defined by those interfaces .
952957
953958Fields on a GraphQL interface have the same rules as fields on a GraphQL object ;
954959their type can be Scalar , Object , Enum , Interface , or Union , or any wrapping
@@ -1038,6 +1043,22 @@ interface. Querying for `age` is only valid when the result of `entity` is a
10381043}
10391044```
10401045
1046+ When defining an interface that implements another interface, the implementing
1047+ interface must define each field that is specified by the implemented interface.
1048+ For example, the interface Resource must define the field id to implement the
1049+ Node interface:
1050+
1051+ ``` graphql example
1052+ interface Node {
1053+ id : ID !
1054+ }
1055+
1056+ interface Resource implements Node {
1057+ id : ID !
1058+ url : String
1059+ }
1060+ ```
1061+
10411062**Result Coercion **
10421063
10431064The interface type should have some way of determining which object a given
@@ -1065,6 +1086,38 @@ Interface types have the potential to be invalid if incorrectly defined.
10651086 characters {"__" } (two underscores).
10661087 2. The argument must accept a type where {IsInputType (argumentType)}
10671088 returns {true }.
1089+ 3. An interface type may declare that it implements one or more unique
1090+ interfaces , but may not implement itself .
1091+ 4. An interface type must be a super -set of all interfaces it implements :
1092+ 1. The implementing interface type must include a field of the same name for
1093+ every field defined in an implemented interface .
1094+ 1. The implementing interface field must be of a type which is equal to or
1095+ a sub -type of the implemented interface field (covariant).
1096+ 1. An implementing interface field type is a valid sub -type if it is
1097+ equal to (the same type as) the implemented interface field type .
1098+ 2. An implementing interface field type is a valid sub -type if it is an
1099+ Object type and the implemented interface field type is either an
1100+ Interface type or a Union type and the implementing interface field
1101+ type is a possible type of the implemented interface field type .
1102+ 3. An implementing interface field type is a valid sub -type if it is an
1103+ Interface type and the implemented interface field type is either an
1104+ Interface type or a Union type and the implementing interface field
1105+ type is a possible type of the implemented interface field type .
1106+ 4. An implementing interface field type is a valid sub -type if it is a
1107+ List type and the implemented interface field type is also a List
1108+ type and the list -item type of the implementing interface field type
1109+ is a valid sub -type of the list -item type of the implemented
1110+ interface field type .
1111+ 5. An implementing interface field type is a valid sub -type if it is a
1112+ Non -Null variant of a valid sub -type of the implemented interface
1113+ field type .
1114+ 2. The implementing interface field must include an argument of the same
1115+ name for every argument defined in the implemented interface field .
1116+ 1. The implementing interface field argument must accept the same type
1117+ (invariant) as the implemented interface field argument .
1118+ 3. The implementing interface field may include additional arguments not
1119+ defined in the implemented interface field , but any additional argument
1120+ must not be required .
10681121
10691122
10701123### Interface Extensions
@@ -1114,10 +1167,12 @@ Interface type extensions have the potential to be invalid if incorrectly define
11141167 fields may share the same name .
111511683. Any fields of an Interface type extension must not be already defined on the
11161169 original Interface type .
1117- 4. Any Object type which implemented the original Interface type must also be a
1118- super -set of the fields of the Interface type extension (which may be due to
1119- Object type extension).
1170+ 4. Any Object or Interface type which implemented the original Interface type
1171+ must also be a super -set of the fields of the Interface type extension (which
1172+ may be due to Object type extension).
112011735. Any directives provided must not already apply to the original Interface type .
1174+ 6. The resulting extended interface type must be a super -set of all interfaces
1175+ it implements .
11211176
11221177
11231178## Unions
0 commit comments