From b20607904737f49a85a23b3e2aaac89db3efa8c0 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Sun, 13 Sep 2015 17:44:31 +0200 Subject: [PATCH] Add missing `=` required default values and unions --- Data/GraphQL/Parser.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Data/GraphQL/Parser.hs b/Data/GraphQL/Parser.hs index 013dd9b..42f52a0 100644 --- a/Data/GraphQL/Parser.hs +++ b/Data/GraphQL/Parser.hs @@ -73,7 +73,10 @@ variableDefinition :: Parser VariableDefinition variableDefinition = VariableDefinition <$> variable <* s <* ":" <* s <*> type_ <* s - <*> value + <*> (defaultValue <|> empty) + +defaultValue :: Parser DefaultValue +defaultValue = "=" *> s *> value -- In defense of good taste, I'm taking liberty of not allowing space between -- '$' and the 'name' even though that's not in the spec. @@ -248,6 +251,7 @@ unionTypeDefinition :: Parser UnionTypeDefinition unionTypeDefinition = UnionTypeDefinition <$ "union" <* s1 <*> name <* s + <* "=" <* s <*> unionMembers where -- This should take care of standalone `NamedType`