Releases: ghostdogpr/caliban
v2.9.0
Release Notes
This release brings a few interesting features, such as support for the @stream
directive, alongside a new batch of performance improvements. Note that the @stream
addition caused some changes that impact the @defer
directive usage as well.
The QuickAdapter
now depends on the long-awaited stable 3.0.x version of zio-http, which means no more binary compatibility issues between releases.
Finally, one noticeable change is that we are now using jsoniter internally to encode and decode GraphQL requests and responses, which means you don't need to depend and import one of the tapir-json
libraries anymore.
New features
- Added support the
@stream
directive by @paulpdaniels in #2309 - Made
jsoniter
a required dependency and use it for enc/dec in tapir adapters by @kyri-petrou in #2341 - Added support for introspecting and client codegen of deprecated arguments by @kyri-petrou in #2347
- Added Graphiql endpoints for tapir adapters by @kyri-petrou in #2379
Bug fixes
- Fixed
ArgBuilder
derivation for case classes containing only optional fields by @kyri-petrou in #2408
Performance improvements
- Added param to
GraphQLRequest
to identify GET requests by @kyri-petrou in #2329 - Improved performance of response encoding for jsoniter by @kyri-petrou in #2330
- Improved macro performance by @kyri-petrou in #2332
- Optimized execution of pure and single-field object queries by @kyri-petrou in #2338
- Optimized a tiny thing by @kyri-petrou in #2318
- Optimized
Function0
allocations by @kyri-petrou in #2366 - Optimized
Field#allFieldsUniqueNameAndCondition
by @kyri-petrou in #2368
Important dependency upgrades
- Upgraded ZIO HTTP to 3.0.0 by @kyri-petrou in #2383
v2.8.1
Release Notes
This small release fixes a couple issues related to the @oneOf
introduction in 2.8.0.
Bug fixes
- Fixed
ArgBuilder
derivation when input is a value type by @kyri-petrou in #2323 - Fixed sorting of
oneOf
inputs and added fallback to parent type annotations for@GQLOneOfInput
by @kyri-petrou in #2322
Performance improvements
- Added a method to "suspend" wrappers and reimplement APQs by @kyri-petrou in #2321
v2.8.0
Release Notes
This release brings a long-awaited feature: @oneOf
inputs, based on this RFC which is almost finalized and already implemented in several libraries in other languages. This allows you to use ADTs as input parameters:
@GQLOneOfInput
enum Foo {
case FooString(stringValue: String)
case FooInt(intValue: Int)
}
case class FooArgs(input: Foo)
case class Queries(foo: FooArgs => String)
This will generate the following schema, and the validation will verify that only one of those fields is provided in incoming queries.
input FooInput @oneOf {
stringValue: String
intValue: Int
}
type Queries {
foo(input: FooInput!): String!
}
This release also includes a few breaking changes that should impact a very low amount of users, but here they are just in case:
- Removed code that was deprecated for a long time
- Removed unnecessary type parameter on
Validator.prepare
- Removed
convertHttpStreamingEndpoint
/convertHttpEndpointToFuture
- Migrated the (deprecated) zio-http adapter to use the (recommended) quick adapter, which changes the syntax a bit (you have to pass the interpreter and config directly to the method rather than using the
HttpInterpreter
/WebSocketInterpreter
). If you hadRequestInterceptor
before, you can use zio-httpMiddleware
instead. - Removed the dependency on zio-prelude, so if you relied on Caliban for the transitive dependency, you will have to depend on it explicitly.
- Some methods (such as
GraphQL#interpreter
) that returned aZIO
now return anExit
, which is a subtype ofZIO
that you can convert to anEither
orOption
without needing to run theZIO
New features
- Added support for
@oneOf
inputs for both server and client by @kyri-petrou in #1846 #2294 - Made it easier to use tapir with impure effects such as Ox by @ghostdogpr in #2282
- Added an Scala3-only annotation to derive all case class methods as graphql fields by @kyri-petrou in #2306
- Added a transformer that excludes fields / inputs based on directives by @kyri-petrou in #2293
Bug fixes
- Fixed codegen path on Windows by @OlegYch in #2304
- Fixed derivation of case objects / parameterless case classes that contain
@GQLField
methods by @kyri-petrou in #2305
Performance improvements
- Changed
caliban-zio-http
to depend oncaliban-quick
by @kyri-petrou in #2287 - Utilized ZIO / ZQuery eager constructors and accessors wherever possible by @kyri-petrou in #2297
- Used
Either
instead ofZPure
inValidator
/VariableCoercer
by @kyri-petrou in #2310 - Improved introspection by @kyri-petrou in #2290
- Returned
Exit
for methods in Pagination by @kyri-petrou in #2298 - Used
Either
instead ofZIO
for methods that don't require it by @kyri-petrou in #2292 - Avoided repeating validations on Fragments by @kyri-petrou in #2315
Code cleanup
- Removed deprecated methods from zio-json update by @kyri-petrou in #2286
- Deleted deprecated rendering by @paulpdaniels in #2266
- Removed unnecessary param from
Validator.prepare
by @kyri-petrou in #2291 - Removed dependency on
zio-prelude
by @kyri-petrou in #2314
v2.7.2
Release Notes
This release contains a few bug fixes and performance improvements.
Bug fixes
- Fixed cats interop field nullability by @kyri-petrou in #2296
- Fixed federation v2 introspection and added federation 2.8 by @paulpdaniels in #2273
- Fixed Scala 3 enum and union member name sorting by @guymers in #2275
- Used
Nothing
as routes error type by @kyri-petrou in #2264
Performance improvements
- Disabled Netty's leak detection in
QuickAdapter#runServer
by @kyri-petrou in #2288 - Added minor code readability improvements and micro-optimizations by @kyri-petrou in #2289
- Optimized
Field
creation when the SelectionSet doesn't contain fragments by @kyri-petrou in #2280 - Reduced derivation codegen size for Scala 3 by @kyri-petrou in #2270
- Used
AtomicReference
instead ofRef
in theExecutor
by @kyri-petrou in #2277 - Made
allFieldsMap
private on __Type and use an accessor method by @kyri-petrou in #2279
Important dependency upgrades
- Updated zio json to 0.7.0 by @kyri-petrou in #2285
v2.7.1
Release Notes
This release contains a couple bug fixes and a small addition.
New features
- Added
Schema
andArgBuilder
for zio-json'sJson
#2260 by @paulpdaniels
Bug fixes
- Fixed the
ExcludeArgument
transformer so that it doesn't exclude non-nullable arguments #2257 by @kyri-petrou - Fixed missing error path and location when a failure happens in a field wrapper #2259 by @ghostdogpr
v2.7.0
Release Notes
This release contains several new features as well as a few performance improvements.
Schema transformations
You can now transform types, fields or arguments of an existing GraphQL
object. This gives you an easy alternative to modifying schemas. You can also implement your own custom transformers.
api
.transform(Transformer.RenameType("InnerObject" -> "Renamed"))
.transform(Transformer.ExcludeField("Query" -> "myField"))
Scala 3 union type derivation
You can now derive schemas from Scala 3 union types, and they will be translated to GraphQL unions:
type Payload = Foo | Bar
given Schema[Any, Payload] = Schema.unionType[Payload] // in GraphQL => union Payload = Foo | Bar
New features
- Added schema transformations #2218 by @ghostdogpr and @kyri-petrou
- Added derivation of
Schema
for Scala 3 union types #2215 by @oyvindberg - Added
@semanticNonNull
directive support #2180 by @XiNiHa - Added a Scala 3-specific method for building custom schemas #2211 by @kyri-petrou
Performance improvements
- Optimized random small things #2203 by @kyri-petrou
- Updated zio-prelude and optimized variable coercer #2213 by @kyri-petrou
- Removed usage of
ZIO.scoped
from APQ wrapper #2214 by @kyri-petrou - Improved
resolve
performance in Scala 2 derivation #2239 by @ghostdogpr - Optimized
Parser
#2246 by @kyri-petrou - Optimized usages of
Configurator
#2250 by @kyri-petrou
Important dependency upgrades
- Updated zio-http to 3.0.0-RC8 #2251 by @kyri-petrou
v2.6.0
Release Notes
The highlight of this release is that Websocket support has been added to the QuickAdapter
(the adapter that's the fastest to use and also provides the best performance). Since this adapter is using zio-http under the hood, we deprecated the existing tapir-based ZHttpAdapter
which you can simply replace by the QuickAdapter
. A small breaking change coming with this change is that we moved WebSocketHooks
to another package and changed the type to describe transformation from StreamTransformer
to ZPipeline
.
Apart from that, there are quite a few performance improvements, in particular some coming from zio-query that should make things a lot faster if you use queries with a DataSource
.
New features
- Added WebSocket support to
caliban-quick
#2150 by @kyri-petrou - Added
excludeDeprecated
option to client code generation #2163 by @jeejeeone - Allowed prepending input path to
HttpInterpreter
-generated Tapir endpoints #2188 by @olisikh - Allowed providing a custom
zio.query.Cache
when executing queries by @kyri-petrou - Added
interpreterUnsafe
method toGraphQL
#2160 by @kyri-petrou
Bug fixes
- Fixed incorrect wrapping of pure values by some FieldWrappers #2162 by @kyri-petrou
- Fixed enum annotation issue #2166 by @kyri-petrou
- Fixed
InputValue.ObjectValue#toString
#2173 by @ghostdogpr
Performance improvements
- Optimized performance of
Schema
,ArgBuilder
andExecutor
#2120 by @kyri-petrou - Updated
zio-query
to get better performance #2177 by @kyri-petrou - Improved jsoniter encoding performance #2181 by @kyri-petrou
- Avoided unnecessary .units in Validator #2182 by @kyri-petrou
- Improved performance of
ApolloFederatedTracing
wrapper #2167 by @kyri-petrou
Important dependency upgrades
- Updated
zio-http
to 3.0.0-RC6 #2159 by @kyri-petrou
v2.5.3
Release Notes
This release includes support for subscriptions over Server-Sent Events, as well as a few bug fixes and improvements.
Server
- Added support for subscriptions over Server-Sent Events #2126 by @SvenW and #2141 by @kyri-petrou
- Fixed an issue with error handling with
application/graphql-response+json
#2144 by @ghostdogpr - Optimized performance #2121 #2142 by @kyri-petrou
- Added
Mixed
query execution mode, where top-level fields are guaranteed to be executed in parallel and nested fields are executed in batched mode #2129 by @kyri-petrou - Improved UX for constructing a Caliban interpreter via interop #2130 by @kyri-petrou
Tools
v2.5.2
Release Notes
This release includes a new set of performance improvements as well as some usability improvements, in particular for schema code generation. It is fully backward compatible with 2.5.0.
Server
- Improved performance #2092 #2102 #2103 #2111 #2113 by @kyri-petrou and #2112 by @ghostdogpr
- Improved QuickAdapter UX & performance #2090 by @kyri-petrou
- Defined a specific
innerThrowable
type for errors raised in ArgBuilders #2118 by @kyri-petrou
Client
- Allowed Jsoniter parsing large JSON payloads #2085 by @ghostdogpr and #2109 by @harrylaou
- Added a
render
method inCalibanClientError
that can render extensions #2110 by @harrylaou
Tools
- Added a new directive called
@newtype
for the schema codegen to mapID
to your own types #2091 by @develeon - Made the schema codegen generate the
@GQLDeprecated
annotation for deprecated fields #2107 by @johnspade - Fixed schema codegen when using derives with a ZIO Environment that is not
Any
#2104 by @develeon - Fixed schema comparison of
implements
#2116 by @ghostdogpr
v2.5.1
Release Notes
This release brings a bug fix for an issue that was introduced in 2.5.0 and possibly caused duplicated fields in responses when using fragments. It is fully backward compatible with 2.5.0.
Server
- Fixed a field merging issue that might cause duplicated fields in responses when using fragments #2077 #2081 by @kyri-petrou
- Added annotations for forcing object fields as nullable / non-nullable #2075 by @kyri-petrou
- Made
Document
serialization friendly-ier #2061 by @kyri-petrou - Added code to catch exceptions happening in
FunctionStep
#2059 by @kyri-petrou
Interop
- Added
InjectEnv
implicit for cats.effect.IO #2062 by @kyri-petrou - Fixed content type performance issue with zio-http #2060 by @kyri-petrou
Tools
- Fix server code generation to support
@lazy
fields with abstract effect #2064 by @johnspade