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