Skip to content

Commit 9565fa1

Browse files
author
Stevan Little
committed
add directives to Variable definitions
1 parent 6d1547a commit 9565fa1

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

ast/ast.ast

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ T VariableDefinition
3939
S Variable variable
4040
S Type type
4141
S? Value defaultValue
42+
P? Directive directives
4243

4344
T SelectionSet
4445
P Selection selections

parser.ypp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)