You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Functional GraphQL library for Scala, with client code generation and type-safe queries.
3
+
description: Caliban is a functional library for building GraphQL servers and clients in Scala. It offers with client code generation and type-safe queries.
4
4
url: https://ghostdogpr.github.io/caliban/
5
5
github: ghostdogpr/caliban
6
6
---
7
+
8
+
An example of defining a GraphQL query and running it with `caliban`:
description: Caliban is a purely functional library for building GraphQL servers and clients in Scala
3
+
description: Caliban is a functional library for building GraphQL servers and clients in Scala. It offers minimal boilerplate and excellent interoperability.
4
4
url: https://ghostdogpr.github.io/caliban/
5
5
github: ghostdogpr/caliban
6
6
---
7
7
8
-
An example of a GraphQL schema and query with `caliban`:
8
+
An example of a simple GraphQL schema and query with `caliban`:
9
9
10
10
```scala
11
-
importcaliban.GraphQL.graphQL
12
-
importcaliban.RootResolver
13
-
14
-
caseclassCharacter(name: String, age: Int)
15
-
16
-
defgetCharacters():List[Character] =???
11
+
importcaliban._
12
+
importcaliban.schema.Schema.auto._
17
13
18
14
// schema
19
-
caseclassQueries(characters: List[Character])
15
+
caseclassQuery(hello: String)
20
16
21
17
// resolver
22
-
valqueries=Queries(getCharacters)
18
+
valresolver=RootResolver(Query("Hello world!"))
23
19
24
-
valapi= graphQL(RootResolver(queries))
20
+
valapi= graphQL(resolver)
25
21
26
22
for {
27
23
interpreter <- api.interpreter
28
-
result <- interpreter.execute("{ characters { name } }")
0 commit comments