Skip to content

Commit

Permalink
Update schema.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr authored Nov 5, 2019
1 parent 439ab61 commit f37dffd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vuepress/docs/docs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(...)`.
Expand All @@ -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))
```
```

0 comments on commit f37dffd

Please sign in to comment.