Validate input fields have unique names

This commit is contained in:
2020-09-24 05:47:31 +02:00
parent e9a94147fb
commit 9bfa2aa7e8
10 changed files with 84 additions and 30 deletions

View File

@ -177,7 +177,7 @@ constValue (Full.ConstList l) = Type.List $ constValue <$> l
constValue (Full.ConstObject o) =
Type.Object $ HashMap.fromList $ constObjectField <$> o
where
constObjectField (Full.ObjectField key value') = (key, constValue value')
constObjectField (Full.ObjectField key value' _) = (key, constValue value')
-- | Rewrites the original syntax tree into an intermediate representation used
-- for query execution.
@ -383,7 +383,7 @@ value (Full.List list) = Type.List <$> traverse value list
value (Full.Object object) =
Type.Object . HashMap.fromList <$> traverse objectField object
where
objectField (Full.ObjectField name value') = (name,) <$> value value'
objectField (Full.ObjectField name value' _) = (name,) <$> value value'
input :: forall m. Full.Value -> State (Replacement m) (Maybe Input)
input (Full.Variable name) =
@ -399,7 +399,7 @@ input (Full.Object object) = do
objectFields <- foldM objectField HashMap.empty object
pure $ pure $ Object objectFields
where
objectField resultMap (Full.ObjectField name value') =
objectField resultMap (Full.ObjectField name value' _) =
inputField resultMap name value'
inputField :: forall m