diff --git a/vuepress/docs/docs/schema.md b/vuepress/docs/docs/schema.md index 59ded3c463..603bc12e8f 100644 --- a/vuepress/docs/docs/schema.md +++ b/vuepress/docs/docs/schema.md @@ -106,6 +106,11 @@ Caliban provides auto-derivation for common types such as `Int`, `String`, `List ## Effects Fields can return ZIO effects. This allows you to leverage all the features provided by ZIO: timeouts, retries, access to ZIO environment, memoizing, etc. An effect will be ran every time a query requiring the corresponding field is executed. +```scala +case class Queries(characters: Task[List[Character]], + character: CharacterName => RIO[Console, Character]) +``` + If you don't use ZIO environment (`R` = `Any`), there is nothing special to do to get it working. If you require a ZIO environment, you will need to have the content of `caliban.schema.GenericSchema[R]` for your custom `R` in scope when you call `graphQL(...)`. @@ -132,4 +137,4 @@ You can also use the `scalarSchema` helper to create your own scalar types, prov ```scala import caliban.schema._ implicit val unitSchema: Schema[Unit] = scalarSchema("Unit", None, _ => ObjectValue(Nil)) -``` \ No newline at end of file +```