Skip to content

Commit 5d0ca7b

Browse files
committed
[RFC] GraphQL IDL additions
This adds the type definition syntax to the GraphQL specification.
1 parent c5684b2 commit 5d0ca7b

File tree

3 files changed

+317
-21
lines changed

3 files changed

+317
-21
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ EscapedUnicode :: /[0-9A-Fa-f]{4}/
8282
EscapedCharacter :: one of `"` \ `/` b f n r t
8383

8484

85-
## Query Document
85+
## Document
8686

8787
Document : Definition+
8888

8989
Definition :
9090
- OperationDefinition
9191
- FragmentDefinition
92+
- TypeSystemDefinition
9293

9394
OperationDefinition :
9495
- SelectionSet
@@ -172,3 +173,57 @@ NonNullType :
172173
Directives : Directive+
173174

174175
Directive : @ Name Arguments?
176+
177+
TypeSystemDefinition :
178+
- SchemaDefinition
179+
- TypeDefinition
180+
- TypeExtensionDefinition
181+
- DirectiveDefinition
182+
183+
SchemaDefinition : schema { OperationTypeDefinition+ }
184+
185+
OperationTypeDefinition : OperationType : NamedType
186+
187+
TypeDefinition :
188+
- ScalarTypeDefinition
189+
- ObjectTypeDefinition
190+
- InterfaceTypeDefinition
191+
- UnionTypeDefinition
192+
- EnumTypeDefinition
193+
- InputObjectTypeDefinition
194+
195+
ScalarTypeDefinition : scalar Name
196+
197+
ObjectTypeDefinition : type Name ImplementsInterfaces? { FieldDefinition+ }
198+
199+
ImplementsInterfaces : implements NamedType+
200+
201+
FieldDefinition : Name ArgumentsDefinition? : Type
202+
203+
ArgumentsDefinition : ( InputValueDefinition+ )
204+
205+
InputValueDefinition : Name : Type DefaultValue?
206+
207+
InterfaceTypeDefinition : interface Name { FieldDefinition+ }
208+
209+
UnionTypeDefinition : union Name = UnionMembers
210+
211+
UnionMembers :
212+
- NamedType
213+
- UnionMembers | NamedType
214+
215+
EnumTypeDefinition : enum Name { EnumValueDefinition+ }
216+
217+
EnumValueDefinition : EnumValue
218+
219+
EnumValue : Name
220+
221+
InputObjectTypeDefinition : input Name { InputValueDefinition+ }
222+
223+
TypeExtensionDefinition : extend ObjectTypeDefinition
224+
225+
DirectiveDefinition : directive @ Name ArgumentsDefinition? on DirectiveLocations
226+
227+
DirectiveLocations :
228+
- Name
229+
- DirectiveLocations | Name

0 commit comments

Comments
 (0)