From 56b63f1c3eda70e6de5da4b6395b98a378b1e4e7 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 30 Sep 2020 05:14:52 +0200 Subject: Validate input object field names --- src/Language/GraphQL/AST/Document.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Language/GraphQL/AST/Document.hs') diff --git a/src/Language/GraphQL/AST/Document.hs b/src/Language/GraphQL/AST/Document.hs index c870580..0b118af 100644 --- a/src/Language/GraphQL/AST/Document.hs +++ b/src/Language/GraphQL/AST/Document.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE OverloadedStrings #-} -- | This module defines an abstract syntax tree for the @GraphQL@ language. It @@ -72,7 +73,10 @@ instance Ord Location where | otherwise = compare thisColumn thatColumn -- | Contains some tree node with a location. -data Node a = Node a Location deriving (Eq, Show) +data Node a = Node + { value :: a + , location :: Location + } deriving (Eq, Show) -- ** Document @@ -258,7 +262,7 @@ data ObjectField a = ObjectField Name a Location -- Variables are usually passed along with the query, but not in the query -- itself. They make queries reusable. data VariableDefinition = - VariableDefinition Name Type (Maybe ConstValue) Location + VariableDefinition Name Type (Maybe (Node ConstValue)) Location deriving (Eq, Show) -- ** Type References @@ -484,8 +488,8 @@ instance Monoid ArgumentsDefinition where -- @ -- -- The input type "Point2D" contains two value definitions: "x" and "y". -data InputValueDefinition - = InputValueDefinition Description Name Type (Maybe ConstValue) [Directive] +data InputValueDefinition = InputValueDefinition + Description Name Type (Maybe (Node ConstValue)) [Directive] deriving (Eq, Show) -- ** Unions -- cgit v1.2.3