From 10cbf4b9e63738eaa6b9673ba5164e3a0a9736e7 Mon Sep 17 00:00:00 2001 From: Emily Goodwin Date: Tue, 7 Oct 2025 22:13:46 -0400 Subject: [PATCH 1/3] add initial outline for field extensions --- spec/Appendix C -- Grammar Summary.md | 10 +++++ spec/Section 3 -- Type System.md | 58 +++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/spec/Appendix C -- Grammar Summary.md b/spec/Appendix C -- Grammar Summary.md index cc464a4a6..a7fb7ec8d 100644 --- a/spec/Appendix C -- Grammar Summary.md +++ b/spec/Appendix C -- Grammar Summary.md @@ -318,6 +318,12 @@ FieldsDefinition : { FieldDefinition+ } FieldDefinition : Description? Name ArgumentsDefinition? : Type Directives[Const]? +FieldExtension : + +- extend field MemberCoordinate ImplementsInterfaces? Directives[const]? + [lookahead != `{`] +- extend field description MemberCoordinate [lookahead != `{`] + ArgumentsDefinition : ( InputValueDefinition+ ) InputValueDefinition : Description? Name : Type DefaultValue? Directives[Const]? @@ -329,6 +335,10 @@ InterfaceTypeDefinition : - Description? interface Name ImplementsInterfaces? Directives[Const]? [lookahead != `{`] +InterfaceFieldExtension : + +- extend interface MemberCoordinate Directives[const]? + InterfaceTypeExtension : - extend interface Name ImplementsInterfaces? Directives[Const]? diff --git a/spec/Section 3 -- Type System.md b/spec/Section 3 -- Type System.md index 44760852c..0b85ebce6 100644 --- a/spec/Section 3 -- Type System.md +++ b/spec/Section 3 -- Type System.md @@ -1105,6 +1105,36 @@ Object type extensions have the potential to be invalid if incorrectly defined. 6. The resulting extended object type must be a super-set of all interfaces it implements. +### Field Extensions + +FieldExtension : + +- extend field MemberCoordinate ImplementsInterfaces? Directives[const]? + [lookahead != `{`] +- extend field description MemberCoordinate [lookahead != `{`] + +Field extensions are used to represent a field which has been extended from some +previously defined field. For example this may be a GraphQL service which is +itself an extension of another GraphQL service. + +In this example, we can deprecate the id field on the User type. + +```graphql example +extend field User.name @deprecated(”Some reason”) +``` + +** Field Validation ** + +Field validation have the potential to be invalid if incorrectly defined. + +1. The field must already be defined and a field for a Type +2. Any non-repeatable directives provided must not already apply to the previous + field. +3. Any interfaces provided must not be already implemented by the previous + field. +4. The resulting extended field must be a super-set of all interfaces it + implements. + ## Interfaces InterfaceTypeDefinition : @@ -1358,6 +1388,34 @@ defined. 6. The resulting extended Interface type must be a super-set of all Interfaces it implements. +#### Interface Field Extensions + +InterfaceFieldExtension : + +- extend interface MemberCoordinate Directives[const]? + +Interface field extensions are used to represent an interface which has been +extended from some previous interface. For example this may be a GraphQL service +which is itself an extension of another GraphQL service. + +In this example, the name field on the User type is deprecated for an interface. + +```graphql example +extend interface User.name @deprecated("Some reason.") +``` + +** Field Validation ** + +Field validation have the potential to be invalid if incorrectly defined. + +1. The field must already be defined and a field for a Type +2. Any non-repeatable directives provided must not already apply to the previous + field. +3. Any interfaces provided must not be already implemented by the previous + field. +4. The resulting extended field must be a super-set of all interfaces it + implements. + ## Unions UnionTypeDefinition : Description? union Name Directives[Const]? From b14e553661921a49161114752aafe647b073be70 Mon Sep 17 00:00:00 2001 From: Emily Goodwin Date: Wed, 8 Oct 2025 22:18:00 -0400 Subject: [PATCH 2/3] address pr comments --- spec/Appendix C -- Grammar Summary.md | 11 +++----- spec/Section 3 -- Type System.md | 39 +++------------------------ 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/spec/Appendix C -- Grammar Summary.md b/spec/Appendix C -- Grammar Summary.md index a7fb7ec8d..dda675268 100644 --- a/spec/Appendix C -- Grammar Summary.md +++ b/spec/Appendix C -- Grammar Summary.md @@ -320,9 +320,8 @@ Directives[Const]? FieldExtension : -- extend field MemberCoordinate ImplementsInterfaces? Directives[const]? - [lookahead != `{`] -- extend field description MemberCoordinate [lookahead != `{`] +- extend field MemberCoordinate Directives[const]? +- extend field description MemberCoordinate ArgumentsDefinition : ( InputValueDefinition+ ) @@ -334,11 +333,7 @@ InterfaceTypeDefinition : FieldsDefinition - Description? interface Name ImplementsInterfaces? Directives[Const]? [lookahead != `{`] - -InterfaceFieldExtension : - -- extend interface MemberCoordinate Directives[const]? - + InterfaceTypeExtension : - extend interface Name ImplementsInterfaces? Directives[Const]? diff --git a/spec/Section 3 -- Type System.md b/spec/Section 3 -- Type System.md index 0b85ebce6..0750d0f47 100644 --- a/spec/Section 3 -- Type System.md +++ b/spec/Section 3 -- Type System.md @@ -1109,9 +1109,8 @@ Object type extensions have the potential to be invalid if incorrectly defined. FieldExtension : -- extend field MemberCoordinate ImplementsInterfaces? Directives[const]? - [lookahead != `{`] -- extend field description MemberCoordinate [lookahead != `{`] +- extend field MemberCoordinate Directives[const]? +- extend field description MemberCoordinate Field extensions are used to represent a field which has been extended from some previously defined field. For example this may be a GraphQL service which is @@ -1127,13 +1126,9 @@ extend field User.name @deprecated(”Some reason”) Field validation have the potential to be invalid if incorrectly defined. -1. The field must already be defined and a field for a Type +1. MemberCoordinate must be resolved to an existing field on a object or interface type. 2. Any non-repeatable directives provided must not already apply to the previous field. -3. Any interfaces provided must not be already implemented by the previous - field. -4. The resulting extended field must be a super-set of all interfaces it - implements. ## Interfaces @@ -1388,34 +1383,6 @@ defined. 6. The resulting extended Interface type must be a super-set of all Interfaces it implements. -#### Interface Field Extensions - -InterfaceFieldExtension : - -- extend interface MemberCoordinate Directives[const]? - -Interface field extensions are used to represent an interface which has been -extended from some previous interface. For example this may be a GraphQL service -which is itself an extension of another GraphQL service. - -In this example, the name field on the User type is deprecated for an interface. - -```graphql example -extend interface User.name @deprecated("Some reason.") -``` - -** Field Validation ** - -Field validation have the potential to be invalid if incorrectly defined. - -1. The field must already be defined and a field for a Type -2. Any non-repeatable directives provided must not already apply to the previous - field. -3. Any interfaces provided must not be already implemented by the previous - field. -4. The resulting extended field must be a super-set of all interfaces it - implements. - ## Unions UnionTypeDefinition : Description? union Name Directives[Const]? From 20e079fc645afdbe46eb9094872038ad0dc13d90 Mon Sep 17 00:00:00 2001 From: Emily Goodwin Date: Thu, 9 Oct 2025 18:02:58 -0400 Subject: [PATCH 3/3] minor formatting changes --- spec/Appendix C -- Grammar Summary.md | 6 +++--- spec/Section 3 -- Type System.md | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spec/Appendix C -- Grammar Summary.md b/spec/Appendix C -- Grammar Summary.md index dda675268..2d9a82a4d 100644 --- a/spec/Appendix C -- Grammar Summary.md +++ b/spec/Appendix C -- Grammar Summary.md @@ -320,8 +320,8 @@ Directives[Const]? FieldExtension : -- extend field MemberCoordinate Directives[const]? -- extend field description MemberCoordinate +- extend field MemberCoordinate Directives[Const] +- extend field Description MemberCoordinate ArgumentsDefinition : ( InputValueDefinition+ ) @@ -333,7 +333,7 @@ InterfaceTypeDefinition : FieldsDefinition - Description? interface Name ImplementsInterfaces? Directives[Const]? [lookahead != `{`] - + InterfaceTypeExtension : - extend interface Name ImplementsInterfaces? Directives[Const]? diff --git a/spec/Section 3 -- Type System.md b/spec/Section 3 -- Type System.md index 0750d0f47..85d70dd24 100644 --- a/spec/Section 3 -- Type System.md +++ b/spec/Section 3 -- Type System.md @@ -1109,8 +1109,8 @@ Object type extensions have the potential to be invalid if incorrectly defined. FieldExtension : -- extend field MemberCoordinate Directives[const]? -- extend field description MemberCoordinate +- extend field MemberCoordinate Directives[Const] +- extend field Description MemberCoordinate Field extensions are used to represent a field which has been extended from some previously defined field. For example this may be a GraphQL service which is @@ -1126,7 +1126,8 @@ extend field User.name @deprecated(”Some reason”) Field validation have the potential to be invalid if incorrectly defined. -1. MemberCoordinate must be resolved to an existing field on a object or interface type. +1. MemberCoordinate must be resolved to an existing field on a object or + interface type. 2. Any non-repeatable directives provided must not already apply to the previous field.