diff --git a/Data/GraphQL/AST.hs b/Data/GraphQL/AST.hs index 8a7bbea..3378655 100644 --- a/Data/GraphQL/AST.hs +++ b/Data/GraphQL/AST.hs @@ -25,7 +25,7 @@ data Definition = DefinitionOperation OperationDefinition data OperationDefinition = OperationSelectionSet SelectionSet | OperationDefinition OperationType - Name + (Maybe Name) VariableDefinitions Directives SelectionSet diff --git a/Data/GraphQL/Encoder.hs b/Data/GraphQL/Encoder.hs index 083a31d..924bdea 100644 --- a/Data/GraphQL/Encoder.hs +++ b/Data/GraphQL/Encoder.hs @@ -22,9 +22,9 @@ definition (DefinitionFragment x) = fragmentDefinition x operationDefinition :: OperationDefinition -> Text operationDefinition (OperationSelectionSet sels) = selectionSet sels operationDefinition (OperationDefinition Query name vars dirs sels) = - "query " <> node name vars dirs sels + "query " <> node (fold name) vars dirs sels operationDefinition (OperationDefinition Mutation name vars dirs sels) = - "mutation " <> node name vars dirs sels + "mutation " <> node (fold name) vars dirs sels node :: Name -> VariableDefinitions -> Directives -> SelectionSet -> Text node name vars dirs sels = diff --git a/Data/GraphQL/Parser.hs b/Data/GraphQL/Parser.hs index 820a323..0fb0ffc 100644 --- a/Data/GraphQL/Parser.hs +++ b/Data/GraphQL/Parser.hs @@ -54,7 +54,7 @@ definition = DefinitionOperation <$> operationDefinition operationDefinition :: Parser OperationDefinition operationDefinition = OperationSelectionSet <$> selectionSet <|> OperationDefinition <$> operationType - <*> name + <*> optional name <*> opt variableDefinitions <*> opt directives <*> selectionSet