Enable mutations

This commit is contained in:
2019-06-23 05:38:45 +02:00
parent 5e9bf9648d
commit 2172de3729
3 changed files with 7 additions and 9 deletions

View File

@ -32,7 +32,9 @@ document schema (op :| []) = operation schema op
document _ _ = error "Multiple operations not supported yet"
operation :: Alternative f => Schema f -> AST.Core.Operation -> f Aeson.Value
operation schema (AST.Core.Query flds) =
Aeson.Object . HashMap.singleton "data"
<$> Schema.resolve (NE.toList schema) (NE.toList flds)
operation _ _ = error "Mutations not supported yet"
operation schema (AST.Core.Query flds)
= Aeson.Object . HashMap.singleton "data"
<$> Schema.resolve (NE.toList schema) (NE.toList flds)
operation schema (AST.Core.Mutation flds)
= Aeson.Object . HashMap.singleton "data"
<$> Schema.resolve (NE.toList schema) (NE.toList flds)

View File

@ -8,7 +8,6 @@ import Control.Applicative ( Alternative(..)
import Data.GraphQL.AST
import Language.GraphQL.Lexer
import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.Text as T
import Text.Megaparsec ( lookAhead
, option
, try