Release Notes
Major changes
This release of Caliban is the first one to support Scala 3! 🎉
It required important efforts because 2 major pieces of Caliban were using Scala 2 macros heavily:
- The GraphQL parser is based on Fastparse, which doesn't support Scala 3 yet. For this release, a new parser based on cats-parse was written by @timzaak with some preliminary work by @lvitaly. Since performance is slower than Fastparse, it is currently used only for Scala 3 (Fastparse remains for Scala 2). This might change in the future depending on the availability of alternatives and their performance (ideally, the same parser should be used for both Scala 2 and Scala 3). This change doesn't affect the public API.
- The typeclass derivation is based on Magnolia, which doesn't support Scala 3 yet. It was decided to rely on the typeclass derivation features of Scala 3 without the help of any library. This turned out to work well, and the code is barely longer than it was when using Magnolia, except we have full control and understanding of it now. The public API is the same (you can still use explicit derivation with
gen
).
The following components are available for Scala 3 (more will be added in the future when dependencies support it):
caliban
(with support for circe)caliban-client
(for JVM and JS)caliban-zio-http
(new! see below)
There is one breaking change caused by Scala 3 support: the API for wrappers changed a little bit. Before, wrappers were case classes containing a function such as (Info => ZIO[R, E, A]) => Info => ZIO[R, E, A]
, now they are traits with a similar function to implement. See here how caliban wrappers were migrated. This change only affects you if you created your own wrappers (using caliban wrappers require no change).
Changes can be found in #847 by @ghostdogpr with contributions from @timzaak and @javimartinez.
Other changes
Server (Core)
- Prevented stack overflow when using recursive types in interfaces #863 by @ghostdogpr
- Fixed the optionality of one introspection field #808 by @guymers
- Fixed validation logic for interface fields with arguments #864 by @tjarvstrand
- Added rendering of description for argument fields #845 by @kpbochenek
Server (Adapters/Interop)
- Added a brand new adapter for ZIO HTTP, with support for WebSockets included. Since this is a ZIO-native library, the usage of caliban is the simplest of all the adapters (see example). This is also the first adapter to support Scala 3. Note that this using a Release Candidate as there is no stable release yet. #867 by @frekw
- Reduced
Runtime
requirement for interpreter creation in cats and monix interop #866 by @willtrnr
Client
- Fixed a bug when passing list arguments #782 by @ghostdogpr
Tools
- Added a new command line option to codegen
--scalarMappings
to map scalars to custom types and--imports
to add your own imports to the generated code #810 by @nikodemin - Added
RemoteSchema
for parsing and working with remote schemas via introspection #833 by @frekw - Prevented generating functions with name ending with underscore as it doesn't compile #783 by @johanneshiry