Handle Output enumerations in Schema definition

The third end-to-end test from graphql-js was implemented.
This commit is contained in:
Danny Navarro
2016-02-09 13:31:28 +01:00
parent c385566912
commit df8e43c9aa
3 changed files with 96 additions and 32 deletions

View File

@ -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