Releases: ghostdogpr/caliban
v1.0.1
Release Notes
- Fixed a regression in
caliban-client
causing a wrong error message to be returned ("Result is not an object" instead of the actual error message) by @ghostdogpr.
v1.0.0
Release Notes
1.0.0 Release
A little less than 2 years after the creation of Caliban, I decided it was time for an official 1.0.0 release 🎉
Caliban has been reliable and stable for a long while now, and the few bugs that have been discovered in the recent past were about minor edge cases and immediately fixed. Caliban is currently used at various companies (including mine) and I even saw it mentioned in a few job offers! The public API is not changing much: even the recently added support for Scala 3 didn't cause much public changes (despite important changes under the hood: a new parser and a new derivation mechanism). Most of the changes are now about improving usability and adding support for libraries or GraphQL plug-ins. The documentation is pretty rich and there are a lot of examples available. I think we're in a good shape for a release!
I intend to keep the current process of incrementing the patch version for minor releases that are 100% binary compatible and the minor version for small breaking changes. The major version will be changed if there are changes that requires a non-trivial migration (this is not semantic versioning but I think it is not necessary for a library like Caliban that don't have many libraries depending on it).
Finally, I'd like to thank the 73 contributors who all took a part in making Caliban what it is today. I'm amazed there has been so many of you. If anyone is interested in contributing, reach out to me on Discord and I can guide you through it.
Server
- Added a helper function to manually construct lazy fields #921 by @ghostdogpr
- Fixed description of temporal schemas #925 by @ghostdogpr
- Added a zio-json backend for the Akka HTTP Adapter #819 by @jczuchnowski
Client
Important: There are several changes related to code generation, so it is recommended to re-run the code generation if you upgrade Caliban to this version.
- Added a new module
caliban-client-laminext
for easy usage of Caliban Client with the Laminar Scala.js library. This includes subscriptions support via WebSockets. More details in the docs. #897 by @ghostdogpr - Added an option to drop null values from input objects when building requests #923 by @ghostdogpr
- Added a variant of
toRequest
namedtoRequestWith
that gives access to partial errors and extensions. This replacestoRequestWithExtensions
. Also, partial errors with a non-null response are now handled as a success. #926 by @ghostdogpr - Fixed the generated code when there are arguments that are type aliases #906 by @ghostdogpr
- Prevented name clashes in generated code when an object is named
Field
#918 by @blast-hardcheese - Prevented name clashes in generated code when an object is named
RootQuery
,RootMutation
orRootSubscription
#924 by @ghostdogpr
Tools
- Added support for basic stitching of local and remote schemas. More details in the docs. #896 by @frekw
v0.10.1
Release Notes
Server
- Added support for Scala 3.0.0. Supported modules:
caliban
,caliban-client
,caliban-zio-http
,caliban-cats
andcaliban-monix
#889 #892 by @ghostdogpr - Fixed an incorrect error message when an input object contains a field named "value" #880 by @mszczygiel
v0.10.0
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
v0.9.5
Release Notes
Server (Core)
- Introduced a new parameter
queryExecution
which allows controlling the parallelism of effectful fields in queries #692 by @ghostdogpr with support from @adamgfraser in zio-query. Possible values are:- sequential: effects are executed sequentially
- parallel (default, same behavior as previous versions): effects are executed in parallel
- batched: arbitrary effects are executed sequentially but batched queries (queries optimized with
ZQuery
and aDataSource
) are executed in parallel. This provides better performance if you use mostly batched queries.
- Added helpers to easily generate schemas manually #687 by @paulpdaniels
- This is especially useful when having problems with auto-derivation (e.g. when magnolia has issues with recursive types). See documentation on how to do that. You can generate manual schemas only for parts of your API and keep using auto-derivation for the rest.
- Added
zio-json
interop in addition tocirce
andplay-json
#649 by @paulpdaniels - Implemented federation tracing #701 by @paulpdaniels (see docs)
- Added a new wrapper type
IntrospectionWrapper
that is only applied to introspection, making it possible to control what introspection returns #753 by @macchiatow - Improved
render
to display descriptions on fields and scalars #675 by @jamonkko and #759 by @kpbochenek - Improved
render
to display deprecated fields and enum vals #685 by @heyrutvik - Improved
printErrors
wrapper to print full stack trace (in red) #695 by @palanga - Fixed partial error handling #699 by @ghostdogpr
- Fixed handling of queries with a root fragment #729 by @ghostdogpr
- Fixed schema for
Either
#730 by @ghostdogpr - Fixed
rename
on a union type #728 by @ghostdogpr
Server (Adapters)
Client
- Upgraded sttp to 3.x #748 by @javimartinez
- Added a new option to code generation to generate "view" case classes and selections containing all fields #734 by @iRevive
Tools
- Fixed input fields in
SchemaLoader.fromCaliban
#681 by @ghostdogpr - Fixed schema comparison for descriptions #751 by @kpbochenek
v0.9.4
Release Notes
Server (Core)
- Added support for field metadata optimizations #646 by @jweaver-personal
- This allows you to know which fields were selected in your resolvers. To use it, just make your field
Field => A
orField => (Args => A)
withField
beingcaliban.execution.Field
and containing information about the query. Caliban will "feed" it for you. More info in the docs.
- This allows you to know which fields were selected in your resolvers. To use it, just make your field
- Improved laziness of typeclass derivation #658 by @ghostdogpr and @darl
- This should improve cases where Magnolia tries to auto-derive schemas for types like
List
orOption
instead of using the existing ones. This shouldn't affect existing code but in case of ambiguities, add explicit calls togen[A]
orgenMacro[A].schema
(the latter will provide more detailed error messages).
- This should improve cases where Magnolia tries to auto-derive schemas for types like
- Fixed a bug with interfaces when they're used both in Queries and Mutations #628 by @iRevive
- Added
Schema#rename
#639 by @ghostdogpr - Fixed
wrapPureValues
behavior in field wrappers #666 😈 by @ghostdogpr - Fixed response from fake field
_
(used in union members without fields) #673 by @ghostdogpr
Server (Adapters)
- Added support for
query
query string parameter in POST endpoint of the Play Adapter #641 by @jessenr - Added support for
application/graphql
content type in the Play Adapter #643 by @dgeyer-mdsol - Added support for multipart requests to the Play Adapter. It now requires a runtime with
Blocking with Random
capabilities #500 by @igorfialko
Client
- Renamed classes to avoid conflicts in generated code #642 by @xirc
- Breaking: you will need to re-generate your client if you upgrade to this version
- Made exceptions override
getMessage
for better printing #640 by @tdrozdowski - Added guarantee of case-insensitive name uniqueness #644 by @javimartinez
- Added
mapEither
#651 by @ghostdogpr
v0.9.3
Release Notes
Server
- Fixed a couple of bugs with interfaces #619 by @ghostdogpr
- Allowed custom directives to be added and used in wrappers #597 by @hwielenberg
- Changed the signature of
provideSomeLayerFromRequest
in the Http4s adapter to allow using any environment R #593 by @fokot - Fixed the execution error pass through on die #606 by @paulpdaniels
Client
- Added a pure selection builder helper #595 by @paulpdaniels
Federation
- Handled nested orphans #607 by @paulpdaniels
v0.9.2
Release Notes
Server
- Upgraded
zio-query
to0.2.5
, bringing a x2 speed improvement in the "simple" benchmark scenario #579 thanks to @adamgfraser - Applied the
GQLName
annotation properly to fields #551 by @ghostdogpr - Improved schemas inference #561 by @darl
- Improved validation performance #563 by @ghostdogpr
- Allowed passing errors to wrappers #569 by @paulpdaniels
- Avoided name clash between regular and interop effect schemas #572 by @ghostdogpr
- Properly handled websocket disconnections in the Akka Http Adapter #571 by @moonkev
- Fixed the error message returned for empty queries by @ghostdogpr
Federation
- Added support for orphan types #584 by @paulpdaniels
Tools
v0.9.1
Release Notes
Server (Core)
- Upgraded ZIO and its dependencies to 1.0.0 🎉 #540 by @paulpdaniels
- Fixed a bug causing nested fragments not working properly #532 by @ghostdogpr
- Added a new wrapper
@@ printErrors
that prints errors to the console #513 by @ghostdogpr - Added location and path info to the error when we catch an
ExecutionError
inside a resolver #506 by @paulpdaniels - Improved compatibility of
CalibanError
with Java conventions #505 by @Krever
Server (Adapters)
- Added a
contextWrapper
parameter to the Play Adapter that can be used to inject something into ZIO environment using the request context (e.g. auth info, open tracing metadata) #498 by @paulpdaniels - Added support for
contextWrapper
in subscriptions and improved its usability (Play and Akka Http) #519 by @moonkev - Added support for
application/graphql
andquery
parameter in POST request to Akka HTTP Adapter #514 by @moonkev - Added support for
application/graphql
andquery
parameter in POST request to Http4s Adapter #521 by @moonkev - Added support for
application/graphql
andquery
parameter in POST request to Finch Adapter #525 #528 by @keyno63 - Improved the adapters to handle failures and stream termination in a way that is consistent with Apollo #529 by @moonkev
- Removed
uzhttp
support to reduce maintenance efforts and because its usage is not recommended according to its maintainer. If you want it back, come tell us on Discord.
Client
- Added the ability to specify a query name #527 by @paulpdaniels
- Added
extensions
toGraphQLResponseError
#503 by @cilicio
v0.9.0
Release Notes
Performance Improvements
This release comes with various performance improvements done in #490 by @ghostdogpr and @yoohaemin.
Query parsing, validation, execution: every phase has seen some optimizations! 🎉
Benchmarks show that the introspection query is executed 4x faster than before.
Before:
[info] Benchmark Mode Cnt Score Error Units
[info] GraphQLBenchmarks.introspectCaliban thrpt 5 565.365 ± 27.284 ops/s
[info] GraphQLBenchmarks.introspectSangria thrpt 5 485.646 ± 7.157 ops/s
[info] GraphQLBenchmarks.simpleCaliban thrpt 5 15850.452 ± 554.077 ops/s
[info] GraphQLBenchmarks.simpleSangria thrpt 5 7710.546 ± 140.220 ops/s
After:
[info] Benchmark Mode Cnt Score Error Units
[info] GraphQLBenchmarks.introspectCaliban thrpt 5 2249.019 ± 30.014 ops/s
[info] GraphQLBenchmarks.introspectSangria thrpt 5 495.380 ± 14.566 ops/s
[info] GraphQLBenchmarks.simpleCaliban thrpt 5 20622.959 ± 774.391 ops/s
[info] GraphQLBenchmarks.simpleSangria thrpt 5 7939.774 ± 43.622 ops/s
Breaking changes
These improvements cause very minor breaking changes:
- If you had a custom schema calling
toType
, you will need to change it totoType_
which is an optimized version that caches the generated type instead of recalculating it. - If you used the class
Field
in a wrapper,fields
andconditionalFields
have been merged into simplyfields
, with a new parametercondition: Option[String]
to indicate the field is conditional. In addition to improving performance, this allows maintaining the order of fields between the query and the response.
Server changes
- Added builtin support for java time #473 by @paulpdaniels
- Fixed a determinism issue with schema derivation of interfaces #493 by @ghostdogpr
- Used
fromSinkAndSourceCoupled
rather thanfromSinkAndSource
in the Akka Http Adapter so that streams are properly terminated on WebSocket disconnection by the browser #483 by @moonkev - Added a
contextWrapper
parameter to the Akka Http Adapter that can be used to inject something into ZIO environment using the request context (e.g. auth info, open tracing metadata) #494 by @darl
Client changes
- Improved error messages in Caliban Client when a typeclass instance is missing #489 by @ghostdogpr
- Properly handled case class reserved fields in codegen #497 by @ghostdogpr
- Properly escaped double quotes in codegen #485 by @MasseGuillaume
- Exposed "extensions" in Caliban Client #486 by @MasseGuillaume