diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-05-27 23:18:35 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-05-29 13:53:51 +0200 |
| commit | d12577ae717512979c7654191ca65f25fc877907 (patch) | |
| tree | 17eda8d92d92ef2773c439d614f00ea0e74ea969 /tests/Test/DirectiveSpec.hs | |
| parent | c06d0b8e95ea4b87eab69da085cb32dbd052c1f0 (diff) | |
| download | graphql-d12577ae717512979c7654191ca65f25fc877907.tar.gz | |
Define resolvers on type fields
Returning resolvers from other resolvers isn't supported anymore. Since
we have a type system now, we define the resolvers in the object type
fields and pass an object with the previous result to them.
Diffstat (limited to 'tests/Test/DirectiveSpec.hs')
| -rw-r--r-- | tests/Test/DirectiveSpec.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/Test/DirectiveSpec.hs b/tests/Test/DirectiveSpec.hs index 67264c2..55a5277 100644 --- a/tests/Test/DirectiveSpec.hs +++ b/tests/Test/DirectiveSpec.hs @@ -4,7 +4,8 @@ module Test.DirectiveSpec ( spec ) where -import Data.Aeson (Value(..), object, (.=)) +import Data.Aeson (object, (.=)) +import qualified Data.Aeson as Aeson import qualified Data.HashMap.Strict as HashMap import Language.GraphQL import Language.GraphQL.Type.Definition @@ -16,12 +17,12 @@ import Text.RawString.QQ (r) experimentalResolver :: Schema IO experimentalResolver = Schema { query = queryType, mutation = Nothing } where - resolver = pure $ Out.Int 5 + resolver = pure $ Int 5 queryType = Out.ObjectType "Query" Nothing [] $ HashMap.singleton "experimentalField" $ Out.Field Nothing (Out.NamedScalarType int) mempty resolver -emptyObject :: Value +emptyObject :: Aeson.Value emptyObject = object [ "data" .= object [] ] |
