Closed Boyce-Lee closed 12 months ago
query definition: OperationType Name_opt VariablesDefinition_opt Directivesopt SelectionSet detail in gql spec query parser logic is wrong: https://github.com/graph-gophers/graphql-go/blob/master/internal/query/query.go
OperationType Name_opt VariablesDefinition_opt Directivesopt SelectionSet
func parseOperation(l *common.Lexer, opType ast.OperationType) *ast.OperationDefinition { op := &ast.OperationDefinition{Type: opType} op.Name.Loc = l.Location() if l.Peek() == scanner.Ident { op.Name = l.ConsumeIdentWithLoc() } op.Directives = common.ParseDirectives(l) // wrong point => should ParseDirectives after ParseInputValue if l.Peek() == '(' { l.ConsumeToken('(') for l.Peek() != ')' { loc := l.Location() l.ConsumeToken('$') iv := common.ParseInputValue(l) iv.Loc = loc op.Vars = append(op.Vars, iv) } l.ConsumeToken(')') } op.Selections = parseSelectionSet(l) return op }
Fixed in this commit. Thank you for reporting this.
query definition:
OperationType Name_opt VariablesDefinition_opt Directivesopt SelectionSet
detail in gql spec query parser logic is wrong: https://github.com/graph-gophers/graphql-go/blob/master/internal/query/query.go