Last active
July 18, 2024 16:28
-
-
Save DGolubets/66f8ae9aac9d5ec0a44222d24f946dcc to your computer and use it in GitHub Desktop.
Caliban interpreter hangs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using scala 3.4.2 | |
//> using dep com.github.ghostdogpr::caliban:2.8.1 | |
//> using dep com.github.ghostdogpr::caliban-quick:2.8.1 | |
import zio.* | |
import zio.query.ZQuery | |
import caliban.* | |
import caliban.schema.Schema.auto.* | |
import caliban.quick.* | |
enum Enum1: | |
case Data(value1: String) | |
enum Enum2: | |
case Data(value2: Int) | |
case class Queries( | |
data1: Option[Enum1], | |
data2: Option[Enum2] | |
) | |
val queries = Queries(None, None) | |
val api = graphQL(RootResolver(queries)) | |
object App extends ZIOAppDefault { | |
def run = | |
api.interpreter | |
.map(QuickAdapter(_).handlers) | |
.flatMap(handlers => zio.http.Server.serve(handlers.api.toRoutes)) | |
.provide(zio.http.Server.default) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment