Skip to content

Commit 3aa021f

Browse files
authored
separate out IsSubType from IsValidImplementationFieldType (graphql#977)
Motivation: IsSubType could be re-used in graphql#973
1 parent 47a6bfd commit 3aa021f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

spec/Section 3 -- Type System.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -924,14 +924,17 @@ IsValidImplementationFieldType(fieldType, implementedFieldType):
924924
2. Let {implementedItemType} be the unwrapped item type of
925925
{implementedFieldType}.
926926
3. Return {IsValidImplementationFieldType(itemType, implementedItemType)}.
927-
3. If {fieldType} is the same type as {implementedFieldType} then return {true}.
928-
4. If {fieldType} is an Object type and {implementedFieldType} is a Union type
929-
and {fieldType} is a possible type of {implementedFieldType} then return
930-
{true}.
931-
5. If {fieldType} is an Object or Interface type and {implementedFieldType} is
932-
an Interface type and {fieldType} declares it implements
933-
{implementedFieldType} then return {true}.
934-
6. Otherwise return {false}.
927+
3. Return {IsSubType(fieldType, implementedFieldType)}.
928+
929+
IsSubType(possibleSubType, superType):
930+
931+
1. If {possibleSubType} is the same type as {superType} then return {true}.
932+
2. If {possibleSubType} is an Object type and {superType} is a Union type and
933+
{possibleSubType} is a possible type of {superType} then return {true}.
934+
3. If {possibleSubType} is an Object or Interface type and {superType} is an
935+
Interface type and {possibleSubType} declares it implements {superType} then
936+
return {true}.
937+
4. Otherwise return {false}.
935938

936939
### Field Arguments
937940

0 commit comments

Comments
 (0)