From 21a7d9cce421352e837945a2334e7ccf10160d8c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 19 Sep 2020 18:18:26 +0200 Subject: Validate variable names are unique --- src/Language/GraphQL/Validate.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Language/GraphQL/Validate.hs') 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' = -- cgit v1.2.3