Skip to content

Commit

Permalink
add directives to Variable definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevan Little committed Oct 12, 2018
1 parent 6d1547a commit 9565fa1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions ast/ast.ast
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ T VariableDefinition
S Variable variable
S Type type
S? Value defaultValue
P? Directive directives

T SelectionSet
P Selection selections
Expand Down
2 changes: 1 addition & 1 deletion parser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ variable: VARIABLE { $$ = new Variable(@$, new Name(@1, strdup($1))); }
;

variable_definition:
variable ":" type default_value_opt { $$ = new VariableDefinition(@$, $1, $3, $4); }
variable ":" type default_value_opt directives_opt { $$ = new VariableDefinition(@$, $1, $3, $4, $5); }
;

default_value_opt:
Expand Down
7 changes: 7 additions & 0 deletions test/kitchen-sink.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ fragment frag on Friend {
unnamed(truthy: true, falsey: false, nullish: null),
query
}
query queryByName($name: String @default(value: 100)) {
findByName(name: $name) {
name
}
}
2 changes: 1 addition & 1 deletion test/kitchen-sink.json

Large diffs are not rendered by default.

0 comments on commit 9565fa1

Please sign in to comment.