diff options
| author | Danny Navarro <j@dannynavarro.net> | 2015-10-19 12:19:39 +0200 |
|---|---|---|
| committer | Danny Navarro <j@dannynavarro.net> | 2015-10-19 12:19:39 +0200 |
| commit | 4e5dc3433a53c2e0404fd2adb9fb33c898d1afa6 (patch) | |
| tree | bb58db83119bb0152a0df5ef76d4ebd6baa151c7 /Data | |
| parent | 3f30a44d1d9464ec112246c7dae1a5519b39769e (diff) | |
| download | graphql-4e5dc3433a53c2e0404fd2adb9fb33c898d1afa6.tar.gz | |
Implement first StarWars end-to-end test
`execute` still needs to be implemented.
Diffstat (limited to 'Data')
| -rw-r--r-- | Data/GraphQL/Execute.hs | 6 | ||||
| -rw-r--r-- | Data/GraphQL/Schema.hs | 27 |
2 files changed, 16 insertions, 17 deletions
diff --git a/Data/GraphQL/Execute.hs b/Data/GraphQL/Execute.hs index 9951144..06dc9a6 100644 --- a/Data/GraphQL/Execute.hs +++ b/Data/GraphQL/Execute.hs @@ -10,5 +10,7 @@ import qualified Data.Aeson as Aeson (Value) import Data.GraphQL.AST import Data.GraphQL.Schema -execute :: Applicative f => Schema -> Document -> f Aeson.Value -execute = undefined +type Response = Aeson.Value + +execute :: Applicative f => Schema f -> Document -> f Response +execute _schema _doc = undefined diff --git a/Data/GraphQL/Schema.hs b/Data/GraphQL/Schema.hs index 8d4e1d6..37938ee 100644 --- a/Data/GraphQL/Schema.hs +++ b/Data/GraphQL/Schema.hs @@ -5,26 +5,25 @@ import Data.HashMap.Lazy (HashMap) data Schema f = Schema (QueryRoot f) (Maybe (MutationRoot f)) -type QueryRoot f = Object f +type QueryRoot f = Map f -type MutationRoot f = Object f +type MutationRoot f = Map f -type Object f = HashMap Text (Input -> f Output) +type Map f = HashMap Text (Resolver f) -type ObjectInput = HashMap Text Input +type Resolver f = Input -> Output f -data Output = OutputScalar Scalar - | OutputObject (HashMap Text Output) - | OutputUnion [Output] - | OutputEnum Scalar - | OutputList [Output] - | OutputNonNull Output - | InputError +data Output f = OutputScalar (f Scalar) + | OutputMap (Map f) + | OutputUnion [Map f] + | OutputEnum (f Scalar) + | OutputList [Output f] + | OutputNonNull (Output f) + | InputError data Input = InputScalar Scalar - | InputObject ObjectInput | InputEnum Scalar - | InputList [Output] + | InputList [Input] | InputNonNull Input data Scalar = ScalarInt Int @@ -32,5 +31,3 @@ data Scalar = ScalarInt Int | ScalarString Text | ScalarBool Bool | ScalarID Text - -newtype Interface f = Interface (Object f) |
