From 5654b78935b38a88f3dd4998eb8667a2695aea14 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 12 Apr 2021 07:09:39 +0200 Subject: Traverse input object properties once --- src/Language/GraphQL/Validate/Rules.hs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/Language/GraphQL/Validate/Rules.hs') diff --git a/src/Language/GraphQL/Validate/Rules.hs b/src/Language/GraphQL/Validate/Rules.hs index 905c2a7..a6bc43b 100644 --- a/src/Language/GraphQL/Validate/Rules.hs +++ b/src/Language/GraphQL/Validate/Rules.hs @@ -1582,24 +1582,20 @@ valuesOfCorrectTypeRule = ValueRule go constGo , Full.ConstEnum memberValue <- node , HashMap.member memberValue members = mempty check (In.InputObjectBaseType objectType) Full.Node{ node } - | In.InputObjectType _ _ typeFields <- objectType - , Full.ConstObject valueFields <- node = - foldMap (checkObjectField typeFields) valueFields + -- Skip, objects are checked recursively by the validation traverser. + | In.InputObjectType{} <- objectType + , Full.ConstObject{} <- node = mempty check (In.ListBaseType listType) constValue@Full.Node{ .. } -- Skip, lists are checked recursively by the validation traverser. - | Full.ConstList _ <- node = mempty + | Full.ConstList{} <- node = mempty | otherwise = check listType constValue check inputType Full.Node{ .. } = pure $ Error { message = concat [ "Value " - , show node, " cannot be coerced to type \"" + , show node + , " cannot be coerced to type \"" , show inputType , "\"." ] , locations = [location] } - checkObjectField typeFields Full.ObjectField{..} - | Just typeField <- HashMap.lookup name typeFields - , In.InputField _ fieldType _ <- typeField = - check fieldType value - checkObjectField _ _ = mempty -- cgit v1.2.3