diff --git a/command/command.go b/command/command.go index 27d2bbc..b7d97a4 100644 --- a/command/command.go +++ b/command/command.go @@ -32,7 +32,7 @@ func (c *Command) Check() error { NotEnoughArgs: "❌ Not enough arguments", OutputFileNeeded: "❌ Output file argument is needed", WrongOption: "❌ Wrong options", - Version: "v0.2.7", + Version: "v0.2.8", } help := flag.Bool("h", false, "show the help") diff --git a/lib/parse.go b/lib/parse.go index 3e6b5b3..2218e1c 100644 --- a/lib/parse.go +++ b/lib/parse.go @@ -860,6 +860,10 @@ func ParseDirectives(l *Lexer) []*Directive { } d.DirectiveArgs = append(d.DirectiveArgs, &da) + + if l.Peek() == ',' { + l.ConsumeToken(',') + } } l.ConsumeToken(')') } @@ -876,6 +880,9 @@ func ParseList(l *Lexer) []string { } else { ss = append(ss, l.ConsumeIdent()) } + if l.Peek() == ',' { + l.ConsumeToken(',') + } } return ss } diff --git a/test/Directives.graphql b/test/Directives.graphql index 3c29f74..5d88c4d 100644 --- a/test/Directives.graphql +++ b/test/Directives.graphql @@ -1,12 +1,11 @@ directive @goModel( - model: String - models: [String!] + model: String, models: [String!] ) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION """ TEST """ -interface Node @goModel(model: "todo/ent.Noder") { +interface Node @goModel(model: "todo/ent.Noder", models: ["a", "b"]) { id: ID! # TEST }