Skip to content

Commit eeb1a2c

Browse files
committed
Ensure directives cannot reference variables in SDL
1 parent e575ac8 commit eeb1a2c

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

spec/Appendix B -- Grammar Summary.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ Field : Alias? Name Arguments? Directives? SelectionSet?
115115

116116
Alias : Name :
117117

118-
Arguments : ( Argument+ )
118+
Arguments[Const] : ( Argument[?Const]+ )
119119

120-
Argument : Name : Value
120+
Argument[Const] : Name : Value[?Const]
121121

122122
FragmentSpread : ... FragmentName Directives?
123123

@@ -177,17 +177,17 @@ NonNullType :
177177
- NamedType !
178178
- ListType !
179179

180-
Directives : Directive+
180+
Directives[Const] : Directive[?Const]+
181181

182-
Directive : @ Name Arguments?
182+
Directive[Const] : @ Name Arguments[?Const]?
183183

184184
TypeSystemDefinition :
185185
- SchemaDefinition
186186
- TypeDefinition
187187
- DirectiveDefinition
188188
- TypeExtension
189189

190-
SchemaDefinition : schema Directives? { OperationTypeDefinition+ }
190+
SchemaDefinition : schema Directives[Const]? { OperationTypeDefinition+ }
191191

192192
OperationTypeDefinition : OperationType : NamedType
193193

@@ -199,35 +199,35 @@ TypeDefinition :
199199
- EnumTypeDefinition
200200
- InputObjectTypeDefinition
201201

202-
ScalarTypeDefinition : scalar Name Directives?
202+
ScalarTypeDefinition : scalar Name Directives[Const]?
203203

204-
ObjectTypeDefinition : type Name ImplementsInterfaces? Directives? FieldDefinitions
204+
ObjectTypeDefinition : type Name ImplementsInterfaces? Directives[Const]? FieldDefinitions
205205

206206
ImplementsInterfaces : implements NamedType+
207207

208208
FieldDefinitions : { FieldDefinition+ }
209209

210-
FieldDefinition : Name ArgumentsDefinition? : Type Directives?
210+
FieldDefinition : Name ArgumentsDefinition? : Type Directives[Const]?
211211

212212
ArgumentsDefinition : ( InputValueDefinition+ )
213213

214-
InputValueDefinition : Name : Type DefaultValue? Directives?
214+
InputValueDefinition : Name : Type DefaultValue? Directives[Const]?
215215

216-
InterfaceTypeDefinition : interface Name Directives? FieldDefinitions
216+
InterfaceTypeDefinition : interface Name Directives[Const]? FieldDefinitions
217217

218-
UnionTypeDefinition : union Name Directives? = UnionMembers
218+
UnionTypeDefinition : union Name Directives[Const]? = UnionMembers
219219

220220
UnionMembers :
221221
- NamedType
222222
- UnionMembers | NamedType
223223

224-
EnumTypeDefinition : enum Name Directives? { EnumValueDefinition+ }
224+
EnumTypeDefinition : enum Name Directives[Const]? { EnumValueDefinition+ }
225225

226-
EnumValueDefinition : EnumValue Directives?
226+
EnumValueDefinition : EnumValue Directives[Const]?
227227

228228
EnumValue : Name
229229

230-
InputObjectTypeDefinition : input Name Directives? { InputValueDefinition+ }
230+
InputObjectTypeDefinition : input Name Directives[Const]? { InputValueDefinition+ }
231231

232232
DirectiveDefinition : directive @ Name ArgumentsDefinition? on DirectiveLocations
233233

@@ -237,4 +237,4 @@ DirectiveLocations :
237237

238238
TypeExtension : extend ObjectTypeExtension
239239

240-
ObjectTypeExtension : type Name ImplementsInterfaces? Directives? FieldDefinitions?
240+
ObjectTypeExtension : type Name ImplementsInterfaces? Directives[Const]? FieldDefinitions?

spec/Section 2 -- Language.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ unique identifier.
323323

324324
## Arguments
325325

326-
Arguments : ( Argument+ )
326+
Arguments[Const] : ( Argument[?Const]+ )
327327

328-
Argument : Name : Value
328+
Argument[Const] : Name : Value[?Const]
329329

330330
Fields are conceptually functions which return values, and occasionally accept
331331
arguments which alter their behavior. These arguments often map directly to
@@ -1064,9 +1064,9 @@ Type : Type !
10641064

10651065
## Directives
10661066

1067-
Directives : Directive+
1067+
Directives[Const] : Directive[?Const]+
10681068

1069-
Directive : @ Name Arguments?
1069+
Directive[Const] : @ Name Arguments[?Const]?
10701070

10711071
Directives provide a way to describe alternate runtime execution and type
10721072
validation behavior in a GraphQL document.
@@ -1112,7 +1112,7 @@ when illustrating example type systems.
11121112

11131113
### Schema Definition
11141114

1115-
SchemaDefinition : schema { OperationTypeDefinition+ }
1115+
SchemaDefinition : schema Directives[Const]? { OperationTypeDefinition+ }
11161116

11171117
OperationTypeDefinition : OperationType : NamedType
11181118

@@ -1172,7 +1172,7 @@ A GraphQL Type System is defined by many different kinds of types.
11721172

11731173
#### Scalar
11741174

1175-
ScalarTypeDefinition : scalar Name
1175+
ScalarTypeDefinition : scalar Name Directives[Const]?
11761176

11771177
Scalar types represent leaf values in a GraphQL type system. While this GraphQL
11781178
specification describes a set of Scalar types which all GraphQL services must
@@ -1189,17 +1189,17 @@ scalar DateTime
11891189

11901190
#### Object
11911191

1192-
ObjectTypeDefinition : type Name ImplementsInterfaces? Directives? FieldDefinitions
1192+
ObjectTypeDefinition : type Name ImplementsInterfaces? Directives[Const]? FieldDefinitions
11931193

11941194
ImplementsInterfaces : implements NamedType+
11951195

11961196
FieldDefinitions : { FieldDefinition+ }
11971197

1198-
FieldDefinition : Name ArgumentsDefinition? : Type Directives?
1198+
FieldDefinition : Name ArgumentsDefinition? : Type Directives[Const]?
11991199

12001200
ArgumentsDefinition : ( InputValueDefinition+ )
12011201

1202-
InputValueDefinition : Name : Type DefaultValue? Directives?
1202+
InputValueDefinition : Name : Type DefaultValue? Directives[Const]?
12031203

12041204
Object types represent a list of named fields, each of which yield a value of a
12051205
specific type. Each field itself may accept a list of named arguments.
@@ -1219,7 +1219,7 @@ type TodoItem implements Node {
12191219

12201220
#### Interface
12211221

1222-
InterfaceTypeDefinition : interface Name Directives? FieldDefinitions
1222+
InterfaceTypeDefinition : interface Name Directives[Const]? FieldDefinitions
12231223

12241224
Interface types, similarly to Object types represent a list of named fields.
12251225
Interface types are used as the type of a field when one of many possible Object
@@ -1237,7 +1237,7 @@ interface Node {
12371237

12381238
#### Union
12391239

1240-
UnionTypeDefinition : union Name Directives? = UnionMembers
1240+
UnionTypeDefinition : union Name Directives[Const]? = UnionMembers
12411241

12421242
UnionMembers :
12431243
- NamedType
@@ -1257,9 +1257,9 @@ union Actor = User | Business
12571257

12581258
#### Enum
12591259

1260-
EnumTypeDefinition : enum Name Directives? { EnumValueDefinition+ }
1260+
EnumTypeDefinition : enum Name Directives[Const]? { EnumValueDefinition+ }
12611261

1262-
EnumValueDefinition : EnumValue Directives?
1262+
EnumValueDefinition : EnumValue Directives[Const]?
12631263

12641264
EnumValue : Name
12651265

@@ -1279,7 +1279,7 @@ enum Direction {
12791279

12801280
#### Input Object
12811281

1282-
InputObjectTypeDefinition : input Name Directives? { InputValueDefinition+ }
1282+
InputObjectTypeDefinition : input Name Directives[Const]? { InputValueDefinition+ }
12831283

12841284
Input Object types represent complex input values which may be provided as an
12851285
field argument. Input Object types cannot be the return type of an Object or
@@ -1368,7 +1368,7 @@ or by a GraphQL service which is itself an extension of another GraphQL service.
13681368

13691369
#### Object Type Extension
13701370

1371-
ObjectTypeExtension : type Name ImplementsInterfaces? Directives? FieldDefinitions?
1371+
ObjectTypeExtension : type Name ImplementsInterfaces? Directives[Const]? FieldDefinitions?
13721372

13731373
The named Object type must already exist and be an Object type. Any fields,
13741374
interfaces, or directives provided by the extension must not already exist on

0 commit comments

Comments
 (0)