ghostdogpr / caliban

Functional GraphQL library for Scala
https://ghostdogpr.github.io/caliban/
Apache License 2.0
943 stars 248 forks source link

Supporting Scala.js / Scala Native on the server #1743

Open kubukoz opened 1 year ago

kubukoz commented 1 year ago

Hi! I'm working on the Smithy4s interop for Caliban on the server, in which you could derive a Schema for a Smithy service.

This works fine on the JVM, but Smithy4s supports the two other platforms as well (Native only on Scala 3, though), and I would love to get at least some of that working with Caliban. This would clearly require Caliban to cross-compile as well.

I see that there's Scala.js in the build already, but it seems to be limited to the laminext and client modules.

As far as blockers/difficulties go, I'm only aware of:

If there's anything else you know of, such as any required dependencies that aren't being cross-published, let me know please! I'm happy to get the ball rolling on adding the build axes and getting the shared part of the server to cross-publish. Specifically I'm interested in caliban-cats.

ghostdogpr commented 1 year ago

We had Scala.js cross-compiling for the server a long time ago but dropped it because it was annoying dependency-wise and there was nobody using it.

What would be the use case? None of the http libraries behind the adapters support Scala.js nor Scala Native AFAIK.

kubukoz commented 1 year ago

Http4s works on both of these platforms :)

ghostdogpr commented 1 year ago

Oh I see, I was looking at the weird versions here https://mvnrepository.com/artifact/org.http4s/http4s-dsl

ghostdogpr commented 1 year ago

The issues I see for the core module only:

ghostdogpr commented 11 months ago

Since my previous message, we switched to the latest magnolia and there's a version of play-json for Scala.js. That means we should be able to support Scala.js easily now

ghostdogpr commented 11 months ago

For Scala native, i see zio-Json supports it now so the only blocker might be zio-query which is probably easy to port.