From 6fe9eb72e42fb4ae36435324148e8f96e871a26c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 18 Jun 2021 06:51:14 +0200 Subject: Fix merging fields with arguments executeField shouldn't assume that a selection has only one field with a given name, but it should take the first field. The underlying cause is a wrong pattern, which (because of the laziness) is executed only if the field has arguments. --- src/Language/GraphQL/Execute/Execution.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Language/GraphQL/Execute/Execution.hs b/src/Language/GraphQL/Execute/Execution.hs index 742a6a9..a217d9c 100644 --- a/src/Language/GraphQL/Execute/Execution.hs +++ b/src/Language/GraphQL/Execute/Execution.hs @@ -97,7 +97,7 @@ executeField fieldResolver prev fields where executeField' fieldDefinition resolver = do let Out.Field _ fieldType argumentDefinitions = fieldDefinition - let (Transform.Field _ _ arguments' _ _ :| []) = fields + let Transform.Field _ _ arguments' _ _ = NonEmpty.head fields case coerceArgumentValues argumentDefinitions arguments' of Nothing -> addError null $ Error "Argument coercing failed." [] [] Just argumentValues -> do -- cgit v1.2.3