Skip to content

Commit a67c152

Browse files
author
Stevan Little
committed
add directives to Variable definitions
1 parent a292268 commit a67c152

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

ast/ast.ast

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ T VariableDefinition
4141
S Variable variable
4242
S Type type
4343
S? Value defaultValue
44+
P? Directive directives
4445

4546
T SelectionSet
4647
P Selection selections

parser.ypp

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ variable: VARIABLE { $$ = new Variable(@$, new Name(@1, strdup($1))); }
391391
;
392392

393393
variable_definition:
394-
variable ":" type default_value_opt { $$ = new VariableDefinition(@$, $1, $3, $4); }
394+
variable ":" type default_value_opt directives_opt { $$ = new VariableDefinition(@$, $1, $3, $4, $5); }
395395
;
396396

397397
default_value_opt:

test/kitchen-sink.graphql

+7
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ fragment frag on Friend {
5757
unnamed(truthy: true, falsey: false, nullish: null),
5858
query
5959
}
60+
61+
query queryByName($name: String @default(value: 100)) {
62+
findByName(name: $name) {
63+
name
64+
}
65+
}
66+

test/kitchen-sink.json

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)