diff options
| author | Eugen Wissner <belka@caraus.de> | 2020-05-21 10:20:59 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2020-05-21 10:20:59 +0200 |
| commit | c3ecfece0358d79dd1da6efbe6ab83e63bf50f88 (patch) | |
| tree | 1ff3de1ddd4bf2e04da57cd6d1c889520c263427 /docs | |
| parent | a5c44f30facdaabd94ed25953a3bd88005efa868 (diff) | |
| download | graphql-c3ecfece0358d79dd1da6efbe6ab83e63bf50f88.tar.gz | |
Coerce variable values
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorial/tutorial.lhs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/tutorial/tutorial.lhs b/docs/tutorial/tutorial.lhs index afef8d0..9b04ea3 100644 --- a/docs/tutorial/tutorial.lhs +++ b/docs/tutorial/tutorial.lhs @@ -39,7 +39,9 @@ First we build a GraphQL schema. > schema1 = Schema queryType Nothing > > queryType :: ObjectType IO -> queryType = ObjectType "Query" $ Schema.resolversToMap $ hello :| [] +> queryType = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (hello :| []) > > hello :: Schema.Resolver IO > hello = Schema.scalar "hello" (return ("it's me" :: Text)) @@ -72,7 +74,9 @@ For this example, we're going to be using time. > schema2 = Schema queryType2 Nothing > > queryType2 :: ObjectType IO -> queryType2 = ObjectType "Query" $ Schema.resolversToMap $ time :| [] +> queryType2 = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (time :| []) > > time :: Schema.Resolver IO > time = Schema.scalar "time" $ do @@ -134,7 +138,9 @@ Now that we have two resolvers, we can define a schema which uses them both. > schema3 = Schema queryType3 Nothing > > queryType3 :: ObjectType IO -> queryType3 = ObjectType "Query" $ Schema.resolversToMap $ hello :| [time] +> queryType3 = ObjectType "Query" +> $ Field Nothing (ScalarOutputType string) mempty +> <$> Schema.resolversToMap (hello :| [time]) > > query3 :: Text > query3 = "query timeAndHello { time hello }" |
