Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Caliban to 2.6.0 #125

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val zioK8sVersion = "2.1.1"
val zioCacheVersion = "0.2.3"
val zioCatsInteropVersion = "23.1.0.0"
val sttpVersion = "3.9.3"
val calibanVersion = "2.5.3"
val calibanVersion = "2.6.0"
val redis4catsVersion = "1.5.2"
val redissonVersion = "3.27.1"
val scalaKryoVersion = "1.0.2"
Expand Down Expand Up @@ -80,10 +80,9 @@ lazy val manager = project
.settings(
libraryDependencies ++=
Seq(
"com.github.ghostdogpr" %% "caliban" % calibanVersion,
"com.github.ghostdogpr" %% "caliban-quick" % calibanVersion,
"com.github.ghostdogpr" %% "caliban-zio-http" % calibanVersion,
"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "1.9.8"
"com.github.ghostdogpr" %% "caliban" % calibanVersion,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since caliban-quick depends on caliban, we can actually remove this too and only depend on caliban-quick

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure! I'm just usually wary to use transitive deps, but will do!

Copy link
Contributor Author

@frekw frekw Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"com.github.ghostdogpr" %% "caliban-quick" % calibanVersion,
"com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "1.9.8"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think caliban-quick depends on jsoniter so we can get rid of this too?

Copy link
Contributor Author

@frekw frekw Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)
)

Expand Down
10 changes: 4 additions & 6 deletions manager/src/main/scala/com/devsisters/shardcake/Server.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.devsisters.shardcake

import caliban.interop.tapir.WebSocketInterpreter
import caliban.{ QuickAdapter, ZHttpAdapter }
import caliban.QuickAdapter
import caliban.wrappers.Wrappers.printErrors
import sttp.tapir.json.zio._
import zio.http.{ Server => ZServer, _ }
Expand All @@ -16,12 +15,11 @@ object Server {
for {
config <- ZIO.service[ManagerConfig]
interpreter <- (GraphQLApi.api @@ printErrors).interpreter
apiHandler = QuickAdapter(interpreter).handlers.api
handlers = QuickAdapter(interpreter).handlers
routes = Routes(
Method.ANY / "health" -> Handler.ok,
Method.ANY / "api" / "graphql" -> apiHandler,
Method.ANY / "ws" / "graphql" ->
ZHttpAdapter.makeWebSocketService(WebSocketInterpreter(interpreter))
Method.ANY / "api" / "graphql" -> handlers.api,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really clean now 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's really nice. The quick adapter has been working really well for us in prod so far too, so pretty confident to make this change in Shardcake as well! :)

Method.ANY / "ws" / "graphql" -> handlers.webSocket
) @@ Middleware.cors
_ <- ZIO.logInfo(s"Shard Manager server started on port ${config.apiPort}.")
nothing <- ZServer
Expand Down
Loading