Emit list item errors once

This commit is contained in:
2021-03-16 10:08:13 +01:00
parent 4d762d6356
commit 328e6acdee
4 changed files with 39 additions and 16 deletions

View File

@ -1540,7 +1540,7 @@ valuesOfCorrectTypeRule = ValueRule go constGo
go (Just inputType) value
| Just constValue <- toConstNode value =
lift $ check inputType constValue
go _ _ = lift mempty
go _ _ = lift mempty -- This rule checks only literals.
toConstNode Full.Node{..} = flip Full.Node location <$> toConst node
toConst (Full.Variable _) = Nothing
toConst (Full.Int integer) = Just $ Full.ConstInt integer
@ -1586,8 +1586,8 @@ valuesOfCorrectTypeRule = ValueRule go constGo
, Full.ConstObject valueFields <- node =
foldMap (checkObjectField typeFields) valueFields
check (In.ListBaseType listType) constValue@Full.Node{ .. }
| Full.ConstList listValues <- node =
foldMap (check listType) listValues
-- Skip, lists are checked recursively by the validation traverser.
| Full.ConstList _ <- node = mempty
| otherwise = check listType constValue
check inputType Full.Node{ .. } = pure $ Error
{ message = concat