Releases: ghostdogpr/caliban
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
v2.5.0
Release Notes
This release brings an incredible amount of performance improvements, some major library upgrades (zio-http, Play) as well as some powerful new derivation abilities such as deriving fields from case class methods.
Server
- Improved compile and runtime performance #2013 #2014 #2015 #2017 #2019 #2020 #2021 #2024 #2029 #2031 #2033 #2039 #2044 #2046 #2051 #2052 #2053 #2056 by @kyri-petrou
- Added the ability to exclude fields from interfaces #1975 by @kyri-petrou
- Added the ability to derive fields from case class methods with Scala 3 #2041 by @kyri-petrou
- Added
apply
method toSchema
andArgBuilder
for convenience #2023 by @kyri-petrou - Updated zio-query to 0.6.0 which contains some performance optimizations #2037 @kyri-petrou
- Allowed parallel execution of mutation non-top level fields #2040 by @kyri-petrou
- Implemented path via a
PathValue
type instead ofEither[String, Int]
#2048 by @kyri-petrou
Adapters
- Updated zio-http to RC4 & Play to 3.0.0 #1968 by @kyri-petrou
- Added
api.unsafe.runServer
to run a server immediately in theQuickAdapter
#2050 by @kyri-petrou - Removed unnecessary dependency on pekko-serialization-jackson #2028 by @kyri-petrou
Federation
- Added federation 2.6 support, updated gateway dependencies #2043 by @paulpdaniels
v2.4.3
Release Notes
This version brings a few bug fixes and improvements related to schema derivation on Scala 3.
In addition to that, it contains a new adapter named QuickAdapter
and based on zio-http, that serves 2 purposes:
-
Offer the best performance among all adapters. This adapter is not using Tapir under the hood to prevent any overhead. We picked zio-http and jsoniter-scala because they gave the best benchmarks results among all our supported adapters and json libraries. The only drawback is that it doesn't include WebSocket support at the moment. If you care about performance above all, use this adapter!
-
Be super quick and easy to get started. With this adapter you can simply do that to go from your api to a running server:
import caliban._
import caliban.quick._ // adds syntax to `GraphQL`
val api: GraphQL[Any] = ???
api.runServer(
port = 8080,
apiPath = "/api/graphql",
graphiqlPath = Some("/graphiql")
)
Server
- Added
QuickAdapter
(see above) #1998 by @kyri-petrou - Fixed derivation of nested sum types with Scala 3 #2005 by @kyri-petrou
- Fixed incorrect enum value renaming with Scala 3 #2006 by @kyri-petrou
- Optimized schema derivation with Scala 3 #1995 by @kyri-petrou
Tools
- Fixed incorrect interface description in server code gen #2000 by @ghostdogpr
v2.4.2
Release Notes
This version brings a few bug fixes as well as some performance improvements.
Big thanks to @kyri-petrou for his many contributions!
Server
- Fixed schema renaming on recursive types #1974 by @kyri-petrou
- Fixed schema renaming on interfaces #1978 by @kyri-petrou
- Fixed schema derivation for nested sum types on Scala 3 #1991 #1994 by @kyri-petrou
- Fixed an issue with
@defer
fields not working as expected when backed by DataSources #1981 by @kyri-petrou - Improved performance of resolving large objects #1967 by @kyri-petrou
- Improved performance of jsoniter codecs #1979 by @kyri-petrou
- Improved interface field description #1976 by @kyri-petrou
- Used magnolia macros and reduced Scala 3 compilation time + codegen size #1952 by @kyri-petrou
- Added a helper method for creating custom enum schemas #1953 by @kyri-petrou
Tools
v2.4.1
v2.4.0
Release Notes
This version contains:
- an important number of performance improvements
- support for new specs and protocols: deprecated input fields, GraphQL over HTTP, new Apollo Caching, Federation 2.5
- usability improvements, small fixes and library upgrades
Warning
Due to an issue in zio-http 3.0.0-RC2
, servers exposing websocket endpoints via the caliban-zio-http
module are required to include additional config for subscriptions to work as shown in this example.
This is a temporary workaround until a new version of zio-http
is released which contains a fix to this issue.
Server
- Optimized core performance #1876 #1922 #1929 by @kyri-petrou
- Added support for deprecated input fields (draft spec) #1932 by @ghostdogpr
- Added a wrapper for the new Apollo Caching Protocol. The old is now deprecated #1878 by @paulpdaniels
- Added a simple wrapper to check directives #1905 by @ghostdogpr
- Updated zio-query to the latest version so that it catches
die
errors happening inside theDataSource
#1916 by @ghostdogpr - Fixed
mocking up superclass for module class macros
warning on Scala 3 #1880 by @kyri-petrou - Fixed duplicate types being output when calling
render
on a schema #1888 by @nox213 - Used the latest version of Magnolia #1858 by @kyri-petrou
- Made Introspection introspectable #1900 by @ghostdogpr
- Removed old deprecated code #1902 by @ghostdogpr
- Added the option to disable tracing of pure fields in ApolloTracing wrapper #1907 by @kyri-petrou
- Added the option to dynamically enable / disable ApolloTracing #1933 by @kyri-petrou
- Stopped generating a stack trace in
CalibanError
(not thatgetCause
will returnnull
inValidationError
) #1924 by @kyri-petrou - Changed tracing span name to adhere to semantic guidelines #1875 by @Fluxx
- Fixed inline character escaping when rendering GraphQL #1936 by @paulpdaniels
Adapters
- Added 100% compliance with GraphQL over HTTP spec #1909 by @kyri-petrou
- Updated zio-http to RC2 #1910 by @kyri-petrou
- Enabled support for play-json in Scala 3 #1893 by @kyri-petrou
Tools
- Properly escaped union types in client code generation #1908 by @ghostdogpr
- Fixed various things in server code generation #1925 by @oyvindberg
- Added support for a
@lazy
directive to generate side-effecting fields in server code generation #1927 by @oyvindberg
Federation
- Added federation 2.5 support #1906 by @paulpdaniels
v2.3.1
Release Notes
This version contains important performance improvements as well as support for Pekko.
Server
- Performance improvements
- Drastically improved performance of the metrics wrapper #1850 by @kyri-petrou
- Optimized query execution by resolving fields lazily and prevent unnecessary work #1849 by @kyri-petrou
- Improved performance and correctness of schema and type rendering #1835 by @paulpdaniels
- Reduced size of the code generated by Schema derivation with Scala 3 #1830 by @kyri-petrou
- Optimized
VariableCoercer
#1856 by @kyri-petrou
- Added support for auto enum derivation with Scala 3 #1834 by @kyri-petrou
- Added a wrapper that allows skipping selected validation wrappers during introspection #1837 by @kyri-petrou
- Fixed WS protocol by always returning an id upon errors #1845 by @SvenW
- Added a helper
renderSchema
to render a schema without a resolver #1877 by @ghostdogpr
Adapters
- Added support for Pekko #1862 by @MichelEdkrantz
v2.3.0
Release Notes
This version contains a lot of small fixes as well as performance and usability improvements.
Server
- Added fs2 stream interop #1737 by @satorg
- Added a helper to easily render the schema for a type #1759 by @ghostdogpr
- Optimized validation performance #1820 by @kyri-petrou
- Added
status
label to thegraphql_fields_total
metric #1724 by @SvenW - Added validation of names in
validateSchema
#1731 by @ghostdogpr - Added validation that root types are objects #1735 by @ghostdogpr
- Supported rendering of schema directives even if no queries/mutations/subscriptions #1742 by @yarian
- Improved efficiency of code when deriving
SemiAuto
#1785 by @kyri-petrou - Added support for interfaces implementing interfaces #1803 by @doohochang
- Added support for schema descriptions #1808 by @nox213
- Fixed
fieldWithArgs
schema generation #1812 by @paulpdaniels - Excluded fields with different arguments from interfaces #1815 by @kyri-petrou
Adapters
- Allowed access to
ServerRequest
inconfigure
#1816 by @ghostdogpr - Cached creation of interpreter #1725 by @kyri-petrou
Tools
- Added a parameter for codegen when to enable or disable
isRepeatable
during introspection (disable it if the remote server does not support it) #1732 by @ghostdogpr - Added support for
derives Schema.SemiAuto
in schema code generation #1758 by @nox213
v2.2.1
Release Notes
This is a tiny release with a single change on ZHttpAdapter
(#1723). We noticed that the type signatures of makeHttpService
and makeWebSocketService
were inconsistent (the former returned HttpApp[R, Throwable]
while the latter returned HttpApp[R, Response]
aka App[R]
). We've made them both return App[R]
, which should be easier to use!
v2.2.0
Release Notes
This release brings a few important changes, including a refactor of request interceptors, support for the @defer
directive and support for Scala Native in caliban-client 🚀
Love this project? I am now on Github Sponsors. A good way to give back and encourage future developments! ❤️
New Adapter API
Request interceptors and configuration options such as skipValidation
or enableIntrospection
have been modified to be more powerful: you can now eliminate part of ZIO environment with request interceptors, and you can modify execution configuration dynamically.
These improvements require a small change in existing code. When calling makeHttpService
, makeHttpUploadService
or makeWebSocketService
, you now need to wrap your interpreter into (respectively) an HttpInterpreter
, HttpUploadInterpreter
or WebSocketInterpreter
.
// before
ZHttpAdapter.makeHttpService(interpreter)
// after
ZHttpAdapter.makeHttpService(HttpInterpreter(interpreter))
With these wrapper classes come 2 powerful methods:
configure
takes aConfigurator[R]
which is an alias forURIO[R & Scope, Unit]
.
It allows configuring the interpreter by running an effect that will run for each request and that can modify the configuration of the running fiber. Built-in configurators such assetSkipValidation
,setEnableIntrospection
andsetQueryExecution
are available in theConfigurator
object and let you dynamically change the configuration of the interpreter.intercept
takes anInterceptor[-R1, +R]
which is an alias forZLayer[R1 & ServerRequest, TapirResponse, R]
.
It is basically a more powerful version ofconfigure
that gives you access to the incoming request (ServerRequest
) and lets you modify the environment of the interpreter (fromR
toR1
). A typical use case would be to extract an authentication token from the request and eliminate the authentication requirement from the environment if the token is valid. See an example here. You can also use this to change the configuration based on the incoming request (e.g. allow introspection only when a valid token is present).
val interpreter: GraphQLInterpreter[AuthToken, CalibanError] = ???
// turn our GraphQL interpreter into an HttpInterpreter
val noAuthInterpreter: HttpInterpreter[AuthToken, CalibanError] = HttpInterpreter(interpreter)
// define authentication logic (from a ServerRequest, fail or build an AuthToken)
val auth: ZLayer[ServerRequest, TapirResponse, AuthToken] = ???
// pass our interceptor to eliminate the AuthToken requirement from the environment
val authInterpreter: HttpUploadInterpreter[Any, CalibanError] = httpInterpreter.intercept(auth)
// get our route for Akka Http
val route = AkkaHttpAdapter.makeHttpService(authInterpreter)
This change was done in #1707 by @ghostdogpr
Other changes
Server
- Added experimental support for the
@defer
directive #1480 by @paulpdaniels - Added directives parameter to
scalarSchema
#1694 by @yarian - Added support for
derives ArgBuilder.GenAuto
derivation #1699 by @kyri-petrou - Added support for adding directives to individual enums #1663 by @paulpdaniels
- Fixed
derives Schema.Auto
derivation #1666 by @kyri-petrou - Fixed rendering of directives in arguments #1690 by @tusharmath
- Fixed repeatable directive introspection #1695 by @ghostdogpr
- Fixed propogation of directives in
objectSchema
#1698 by @yarian
Client
- Added support for Scala Native #1682 by @kyri-petrou