Skip to content

Add Directives to Variable definitions #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ast/ast.ast
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ T VariableDefinition
S Variable variable
S Type type
S? Value defaultValue
P? Directive directives

T SelectionSet
P Selection selections
2 changes: 1 addition & 1 deletion parser.ypp
Original file line number Diff line number Diff line change
@@ -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:
7 changes: 7 additions & 0 deletions test/kitchen-sink.graphql
Original file line number Diff line number Diff line change
@@ -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.