summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL/Validate.hs
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2020-09-19 18:18:26 +0200
committerEugen Wissner <belka@caraus.de>2020-09-19 18:18:26 +0200
commit21a7d9cce421352e837945a2334e7ccf10160d8c (patch)
tree5fa09a68cd7e5f7ab9aa1db082f74093bcbeb52c /src/Language/GraphQL/Validate.hs
parent9a08aa5de73e225a9a76017aee4886ce7f6eccec (diff)
downloadgraphql-21a7d9cce421352e837945a2334e7ccf10160d8c.tar.gz
Validate variable names are unique
Diffstat (limited to 'src/Language/GraphQL/Validate.hs')
-rw-r--r--src/Language/GraphQL/Validate.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Language/GraphQL/Validate.hs b/src/Language/GraphQL/Validate.hs
index ff2734d..702935b 100644
--- a/src/Language/GraphQL/Validate.hs
+++ b/src/Language/GraphQL/Validate.hs
@@ -125,12 +125,15 @@ inputValueDefinition rule (InputValueDefinition _ _ _ _ directives') =
directives rule directives'
operationDefinition :: Rule m -> OperationDefinition -> Seq (RuleT m)
-operationDefinition (OperationDefinitionRule rule) operationDefinition' =
- pure $ rule operationDefinition'
-operationDefinition rule (SelectionSet selections _) =
- selectionSet rule selections
-operationDefinition rule (OperationDefinition _ _ _ directives' selections _) =
- selectionSet rule selections >< directives rule directives'
+operationDefinition rule operation
+ | OperationDefinitionRule operationRule <- rule =
+ pure $ operationRule operation
+ | VariablesRule variablesRule <- rule
+ , OperationDefinition _ _ variables _ _ _ <- operation =
+ pure $ variablesRule variables
+ | SelectionSet selections _ <- operation = selectionSet rule selections
+ | OperationDefinition _ _ _ directives' selections _ <- operation =
+ selectionSet rule selections >< directives rule directives'
fragmentDefinition :: Rule m -> FragmentDefinition -> Seq (RuleT m)
fragmentDefinition (FragmentDefinitionRule rule) fragmentDefinition' =