2015-10-17 13:19:00 +02:00
|
|
|
module Data.GraphQL.Schema where
|
|
|
|
|
|
|
|
import Data.Text (Text)
|
|
|
|
import Data.HashMap.Lazy (HashMap)
|
|
|
|
|
2015-10-17 17:49:56 +02:00
|
|
|
data Schema f = Schema (QueryRoot f) (Maybe (MutationRoot f))
|
2015-10-17 13:19:00 +02:00
|
|
|
|
2015-10-19 12:19:39 +02:00
|
|
|
type QueryRoot f = Map f
|
2015-10-17 13:19:00 +02:00
|
|
|
|
2015-10-19 12:19:39 +02:00
|
|
|
type MutationRoot f = Map f
|
2015-10-17 13:19:00 +02:00
|
|
|
|
2015-10-19 12:19:39 +02:00
|
|
|
type Map f = HashMap Text (Resolver f)
|
2015-10-17 13:19:00 +02:00
|
|
|
|
2015-10-19 12:19:39 +02:00
|
|
|
type Resolver f = Input -> Output f
|
2015-10-17 13:19:00 +02:00
|
|
|
|
2015-10-19 12:19:39 +02:00
|
|
|
data Output f = OutputScalar (f Scalar)
|
|
|
|
| OutputMap (Map f)
|
|
|
|
| OutputUnion [Map f]
|
|
|
|
| OutputEnum (f Scalar)
|
|
|
|
| OutputList [Output f]
|
|
|
|
| OutputNonNull (Output f)
|
|
|
|
| InputError
|
2015-10-17 13:19:00 +02:00
|
|
|
|
|
|
|
data Input = InputScalar Scalar
|
|
|
|
| InputEnum Scalar
|
2015-10-19 12:19:39 +02:00
|
|
|
| InputList [Input]
|
2015-10-17 17:49:56 +02:00
|
|
|
| InputNonNull Input
|
2015-10-17 13:19:00 +02:00
|
|
|
|
|
|
|
data Scalar = ScalarInt Int
|
|
|
|
| ScalarFloat Double
|
|
|
|
| ScalarString Text
|
|
|
|
| ScalarBool Bool
|
|
|
|
| ScalarID Text
|