Handle Output enumerations in Schema definition
The third end-to-end test from graphql-js was implemented.
This commit is contained in:
@ -33,6 +33,9 @@ selection _ _ = error "selection: Not implemented yet"
|
||||
output :: (Alternative f, Monad f) => SelectionSet -> Output f -> f Aeson.Value
|
||||
output sels (OutputResolver resolv) = selectionSet resolv sels
|
||||
output sels (OutputList os) = fmap array . traverse (output sels) =<< os
|
||||
output sels (OutputEnum e)
|
||||
| null sels = Aeson.toJSON <$> e
|
||||
| otherwise = empty
|
||||
output sels (OutputScalar s)
|
||||
| null sels = Aeson.toJSON <$> s
|
||||
| otherwise = empty
|
||||
|
@ -14,8 +14,8 @@ type Resolver f = Input -> f (Output f)
|
||||
data Output f = OutputResolver (Resolver f)
|
||||
| OutputList (f [Output f])
|
||||
| OutputScalar (f Scalar)
|
||||
| OutputEnum (f Text)
|
||||
-- | OutputUnion [Output]
|
||||
-- | OutputEnum [Scalar]
|
||||
-- | OutputNonNull (Output)
|
||||
|
||||
data Input = InputScalar Scalar
|
||||
|
Reference in New Issue
Block a user