Enable mutations
This commit is contained in:
parent
5e9bf9648d
commit
2172de3729
@ -32,7 +32,9 @@ document schema (op :| []) = operation schema op
|
|||||||
document _ _ = error "Multiple operations not supported yet"
|
document _ _ = error "Multiple operations not supported yet"
|
||||||
|
|
||||||
operation :: Alternative f => Schema f -> AST.Core.Operation -> f Aeson.Value
|
operation :: Alternative f => Schema f -> AST.Core.Operation -> f Aeson.Value
|
||||||
operation schema (AST.Core.Query flds) =
|
operation schema (AST.Core.Query flds)
|
||||||
Aeson.Object . HashMap.singleton "data"
|
= 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)
|
<$> Schema.resolve (NE.toList schema) (NE.toList flds)
|
||||||
operation _ _ = error "Mutations not supported yet"
|
|
||||||
|
@ -8,7 +8,6 @@ import Control.Applicative ( Alternative(..)
|
|||||||
import Data.GraphQL.AST
|
import Data.GraphQL.AST
|
||||||
import Language.GraphQL.Lexer
|
import Language.GraphQL.Lexer
|
||||||
import Data.List.NonEmpty (NonEmpty(..))
|
import Data.List.NonEmpty (NonEmpty(..))
|
||||||
import qualified Data.Text as T
|
|
||||||
import Text.Megaparsec ( lookAhead
|
import Text.Megaparsec ( lookAhead
|
||||||
, option
|
, option
|
||||||
, try
|
, try
|
||||||
|
@ -38,12 +38,9 @@ import Data.List (dropWhileEnd)
|
|||||||
import Data.Proxy (Proxy(..))
|
import Data.Proxy (Proxy(..))
|
||||||
import Data.Void (Void)
|
import Data.Void (Void)
|
||||||
import Text.Megaparsec ( Parsec
|
import Text.Megaparsec ( Parsec
|
||||||
, MonadParsec
|
|
||||||
, Token
|
|
||||||
, between
|
, between
|
||||||
, chunk
|
, chunk
|
||||||
, chunkToTokens
|
, chunkToTokens
|
||||||
, lookAhead
|
|
||||||
, notFollowedBy
|
, notFollowedBy
|
||||||
, oneOf
|
, oneOf
|
||||||
, option
|
, option
|
||||||
@ -162,7 +159,7 @@ blockString = between "\"\"\"" "\"\"\"" stringValue
|
|||||||
| not (isWhiteSpace $ T.head x) = acc
|
| not (isWhiteSpace $ T.head x) = acc
|
||||||
| acc == 0 = T.length x
|
| acc == 0 = T.length x
|
||||||
| otherwise = min acc $ T.length x
|
| otherwise = min acc $ T.length x
|
||||||
removeIndent n [] = []
|
removeIndent _ [] = []
|
||||||
removeIndent n (x:chunks) = T.drop n x : chunks
|
removeIndent n (x:chunks) = T.drop n x : chunks
|
||||||
|
|
||||||
-- | Parser for integers.
|
-- | Parser for integers.
|
||||||
|
Loading…
Reference in New Issue
Block a user