Bot releases are hidden (Show)
Published by ghostdogpr over 2 years ago
This release contains a few bug fixes, better ergonomics for cats-interop and adapters, as well as a support for Apollo schema reporting.
Types.makeObject
#1294 by @FluxxLong
passed as String
inputs #1304 by @mdulacRequestInterceptor
to return more than just a status code #1288 by @paulpdanielsPublished by ghostdogpr over 2 years ago
This release is the first one to support ZIO 2.0. It is based on ZIO 2.0.0-RC1.
For simplicity, I decided to align the version number with ZIO, so you can immediately recognize which ZIO version it corresponds to.
Keep in mind that this is an early stage version, as ZIO and a bunch of other dependencies are still release candidates.
Note: caliban-monix
is not published for Scala 3 (a bug in ZIO 2.0.0-RC1 prevented this from working). It should be enabled when a version using ZIO 2.0.0-RC2 or higher is published.
Published by ghostdogpr over 2 years ago
This release contains a few bug fixes and improvements, in particular support for Relay.
render
to show directives at the top of the schema #1270 by @FluxxBigInt
& BigDecimal
encoded as Strings #1250 by @nicoburniskeArgEncoder
for UUID
#1266 by @smiklosVector
in generated code so that it doesn't conflict with user types #1254 by @cornermanPublished by ghostdogpr almost 3 years ago
This release fixes a few bugs.
Has
constraint in ZHttpAdapter #1241 by @ghostdogprPublished by ghostdogpr almost 3 years ago
This release fixes a few bugs and brings some goodies.
stop
commands were not properly handled) #1205 by @ghostdogprHttp4sAdapter
with F[_]
and cats-effect #1206 by @ghostdogprRequestInterceptor
to be same as the old ContextWrapper
, making it possible to wrap the effect and change the ZIO environment #1208 by @ghostdogprPublished by ghostdogpr almost 3 years ago
This release brings two important changes to Caliban:
Schema.gen
function has been changed to make it easier to deal with ZIO environment, especially with Scala 3Adapters have been completely rewritten and are now sharing code thanks to Tapir, with the following benefits:
Notable changes:
FinchAdapter
has been removedPlayRouter
has been removed, in favor of PlayAdapter
which is consistent with the other adaptersAkkaHttpAdapter
json support is now done via tapirHttp4sAdapter
requires Clock with Blocking
in the environment (this constraint comes from the tapir interpreter)ContextWrapper
is now RequestInterceptor
Callbacks
is now WebSocketHooks
Look at the documentation for more info. Examples have been updated and migration shouldn't be difficult, but feel free to drop by Discord if you need any help.
Change done in #1125 by @ghostdogpr
gen
functionTL;DR
gen[A]
becomes gen[R, A]
For Scala 2:
You no longer need to worry about calling the right gen
(from Schema
vs GenericSchema
), you can simply use Schema.gen
everywhere. It now takes 2 type parameters R
and A
but you can usually omit them if you explicitly define the return type of your schema.
object schema extends GenericSchema[MyEnv]
import schema._
implicit val queriesSchema: Schema[MyEnv, Queries] = Schema.gen
// or
implicit val queriesSchema = Schema.gen[MyEnv, Queries]
If you use genMacro
, you still need to do it on GenericSchema
.
For Scala 3:
It is no longer necessary to use GenericSchema[R]
. You can simply use Schema.gen
when you need to explicitly derive a schema. Caliban will be able to derive a Schema[R, A]
directly from that.
If your R
is not Any
, you need to pass it to the graphQL
function, unless you already have a Schema[R, Query]
in scope:
val api = graphQL[MyEnv, Queries, Unit, Unit](RootResolver(queries))
// or
implicit val queriesSchema: Schema[MyEnv, Queries] = Schema.gen
val api = graphQL(RootResolver(queries))
If you want to see the code generated by the derivation, you can use Schema.genDebug
instead. It will print the generated code to the console when compiling.
Change done in #1115 by @ghostdogpr
__typename
is not valid at subscription root #1163 by @ghostdogprwithAdditionalTypes
behavior #1170 #1175 #1176 #1177 by @frekw @ghostdogprSelectionBuilder
for each member implementing the interfaceOption
that takes an optional SelectionBuilder
for each member implementing the interface, with default to None
. That allows you not specifying a selection for every possible member.Interface
that takes a SelectionBuilder
of the interface itself. This is useful if you want to select the common fields without having to provide a selection for each member.CalibanPlugin
#1156 by @kubukozcalibanVersion
setting to CalibanPlugin
#1165 by @kubukozPublished by ghostdogpr almost 3 years ago
This is a minor release to fix small bugs and add minor things.
@GQLExcluded
annotation that can hide fields #1141 by @frekwPublished by ghostdogpr almost 3 years ago
This is a minor release to fix some small bugs introduced by the new validations.
GraphQLAspect
to customize a GraphQL
object. See the documentation. #1128 by @paulpdanielsPublished by ghostdogpr almost 3 years ago
Since I started Caliban 2 years ago, there were 3 validation rules that I left aside because they were pretty tricky to implement. Motivated by @frekw who bravely tackled the hardest one, I've implemented the last 2 and Caliban is now 100% compliant with the GraphQL spec! 🎉
If you had invalid queries that were accepted in the past, they might be rejected now so make sure to test before you upgrade Caliban straight to production 😉
isScalar
to the @GQLValueType
annotation to generate a scalar #1127 by @ghostdogprLocationInfo
Play Json serializer #1096 by @ghostdogprapplication/graphql
handling in the ZIO HTTP Adapter #1124 by @frekwPublished by ghostdogpr about 3 years ago
makeWebSocketService
in the Http4s adapter more permissive, allowing you to use a different R between GraphQLInterpreter
and WebSocketBuilder2
#1080 by @ghostdogprctCalibanClientsVersionedCode
to the compile time codegen plugin, so that it generates code in the target
folder #1087 by @guizmaiifinal
#1081 by @guizmaiiPublished by ghostdogpr about 3 years ago
The highlight of this release is the addition of a new sbt plugin to generate your Caliban client code directly from your Caliban server code at compile time. This is useful if you use Caliban on both client and server side. Check the plugin documentation for more details.
Here's a little preview showing how you tell sbt where your GraphQL server API is defined:
lazy val api =
project
.enablePlugins(CompileTimeCalibanServerPlugin)
.settings(
Compile / ctCalibanServer / ctCalibanServerSettings :=
Seq(
"com.example.my.awesome.project.api.CalibanServer.graphqlApi" -> ClientGenerationSettings.default
)
)
It is still very new, so let us know if you encounter any bug. This sbt voodoo magic was brought in #1037 by @guizmaii 🙏
@GQLDefault
annotation for defining the default value of a field #1043 by @frekwSchema
and ArgBuilder
instances for Short
#1011 by @FluxxSchema
instances for non-Throwable errors, see customErrorEffectSchema
, customErrorQuerySchema
and customErrorStreamSchema
#1059 by @ghostdogprEnumValue
instead of StringValue
) #1064 by @frekwmakeWebSocketService
, because WebSocketBuilder
was deprecated by http4s. It now requires a WebSocketBuilder2
. See the examples project for an updated usage. #1075 by @ghostdogprdeprecated
behaviour in SchemaLoader.fromCaliban
#1006 by @ghostdogprLocationInfo
json decoding #1015 by @frekwRemoteSchema
#1018 by @frekwthen
to the list of reserved keywords #1032 by @RhnSharmaSchemaLoader.fromDocument
#1036 by @frekwPublished by ghostdogpr about 3 years ago
Http4sAdapter
using R
instead of Any
for the environment #972 by @ghostdogpr@GQLValueType
that allows redirecting a union type member to a different type defined in another file (removing the "sealed" constraint for unions) #989 by @paulpdaniels__Unknown
instead of failing #976 by @rtimushPublished by ghostdogpr over 3 years ago
The main change in this release is the ability to run caliban client code generation automatically when you compile, instead of the previous (but still supported) manual sbt command. CodegenPlugin
was also renamed to CalibanPlugin
(the old name still exists but is deprecated).
See the updated documentation for more information. This work was done in #933 by @blast-hardcheese.
GQLInterface
and GQLUnion
annotations on enum-like traits #941 by @rtimushField
metadata with federation #939 by @paulpdanielsvalue
helper function for enumeration members in generated code #936 by @blast-hardcheesevalues
helper function on enumerations in generated code, to get the list of possible members #934 by @blast-hardcheesescalarMappings
to be used with enumerations in client codegen #930 by @blast-hardcheese--headers
option #938 by @ghostdogpr--abstractEffectType
to server codegen to generate code with F[_]
#951 by @LaurenceWarnePublished by ghostdogpr over 3 years ago
caliban-client
causing a wrong error message to be returned ("Result is not an object" instead of the actual error message) by @ghostdogpr.Published by ghostdogpr over 3 years ago
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.
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.
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 @ghostdogprtoRequest
named toRequestWith
that gives access to partial errors and extensions. This replaces toRequestWithExtensions
. Also, partial errors with a non-null response are now handled as a success. #926 by @ghostdogprField
#918 by @blast-hardcheeseRootQuery
, RootMutation
or RootSubscription
#924 by @ghostdogprPublished by ghostdogpr over 3 years ago
caliban
, caliban-client
, caliban-zio-http
, caliban-cats
and caliban-monix
#889 #892 by @ghostdogprPublished by ghostdogpr over 3 years ago
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:
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.
Runtime
requirement for interpreter creation in cats and monix interop #866 by @willtrnr--scalarMappings
to map scalars to custom types and --imports
to add your own imports to the generated code #810 by @nikodeminRemoteSchema
for parsing and working with remote schemas via introspection #833 by @frekwPublished by ghostdogpr over 3 years ago
queryExecution
which allows controlling the parallelism of effectful fields in queries #692 by @ghostdogpr with support from @adamgfraser in zio-query. Possible values are:
ZQuery
and a DataSource
) are executed in parallel. This provides better performance if you use mostly batched queries.zio-json
interop in addition to circe
and play-json
#649 by @paulpdanielsIntrospectionWrapper
that is only applied to introspection, making it possible to control what introspection returns #753 by @macchiatowrender
to display descriptions on fields and scalars #675 by @jamonkko and #759 by @kpbochenekrender
to display deprecated fields and enum vals #685 by @heyrutvikprintErrors
wrapper to print full stack trace (in red) #695 by @palangaEither
#730 by @ghostdogprrename
on a union type #728 by @ghostdogprSchemaLoader.fromCaliban
#681 by @ghostdogprPublished by ghostdogpr almost 4 years ago
Field => A
or Field => (Args => A)
with Field
being caliban.execution.Field
and containing information about the query. Caliban will "feed" it for you. More info in the docs.List
or Option
instead of using the existing ones. This shouldn't affect existing code but in case of ambiguities, add explicit calls to gen[A]
or genMacro[A].schema
(the latter will provide more detailed error messages).Schema#rename
#639 by @ghostdogprwrapPureValues
behavior in field wrappers #666 😈 by @ghostdogpr_
(used in union members without fields) #673 by @ghostdogprquery
query string parameter in POST endpoint of the Play Adapter #641 by @jessenrapplication/graphql
content type in the Play Adapter #643 by @dgeyer-mdsolBlocking with Random
capabilities #500 by @igorfialkogetMessage
for better printing #640 by @tdrozdowskimapEither
#651 by @ghostdogprPublished by ghostdogpr almost 4 years ago
provideSomeLayerFromRequest
in the Http4s adapter to allow using any environment R #593 by @fokot