forked from OSS/graphql
Make operation name optional
This commit is contained in:
parent
693b7d18dc
commit
8b09c8aa76
@ -25,7 +25,7 @@ data Definition = DefinitionOperation OperationDefinition
|
||||
|
||||
data OperationDefinition = OperationSelectionSet SelectionSet
|
||||
| OperationDefinition OperationType
|
||||
Name
|
||||
(Maybe Name)
|
||||
VariableDefinitions
|
||||
Directives
|
||||
SelectionSet
|
||||
|
@ -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 =
|
||||
|
@ -54,7 +54,7 @@ definition = DefinitionOperation <$> operationDefinition
|
||||
operationDefinition :: Parser OperationDefinition
|
||||
operationDefinition = OperationSelectionSet <$> selectionSet
|
||||
<|> OperationDefinition <$> operationType
|
||||
<*> name
|
||||
<*> optional name
|
||||
<*> opt variableDefinitions
|
||||
<*> opt directives
|
||||
<*> selectionSet
|
||||
|
Loading…
Reference in New Issue
Block a user