Bot releases are visible (Hide)
Published by ghostdogpr almost 5 years ago
ZQuery
, including a simplification of DataSource
that no longer requires a Service
by @adamgfraser. See #160 for details.Published by ghostdogpr almost 5 years ago
GraphQL[R, Q, M, S, E]
is simplified into GraphQL[R]
.GraphQLInterpreter[R, E]
is a wrapper around GraphQL
that allows changing the R
, the E
and running any wrapper around the execution. It's obtained by just calling .interpreter
on the GraphQL
object. The execute
method is available on this object.GraphQL
objects with |+|
. This allows splitting a large API into smaller chunks and work around Scala limitation of 22 fields.Example:
val api1 = graphQL(...)
val api2 = graphQL(...)
val api = api1 |+| api2
A query analyzer is a piece of code that is executed on a query before its execution. It allows you to analyze the queries and possibly rejecting it, transforming it or running an effect.
This release comes with 2 builtin analyzers for limiting query depth and number of fields:
val api =
maxDepth(2)(
maxFields(5)(
graphQL(...)
)
)
You can use your own by implementing a function with the following signature (with Field
being the root query field):
Field => ZIO[R, CalibanError, Field]
makeRestService
to makeHttpService
. The old name is still there but deprecated. (#125)UUID
so that it returns ID
scalar instead of String
(#126) by @mriceronFuture
(#124)Published by ghostdogpr almost 5 years ago
GraphQL#render
(#108)Published by ghostdogpr almost 5 years ago
Caliban now supports partial failures: instead of returning either an error or a response, it will return a combination of a response and a list of errors. Fields that return an effect that can fail will be defined as nullable and return null
on failure, while adding an entry to the list of errors. Infallible effects like UIO
are unchanged.
GraphQL#execute
now returns a URIO[R, GraphQLResponse[E]]
with:
case class GraphQLResponse[+E](data: ResponseValue, errors: List[E])
If you use the Http4sAdapter
, there is nothing to change.
GraphQL#wrapExecutionWith
is a new method that takes a function and return a new GraphQL
interpreter that'll wrap the execute
method with this function. It is used to implement mapError
(customize errors) and provide
(eliminate the environment), but you can use it for other purposes such as adding a general timeout, logging response times, etc.
The GraphQL
type has a new type parameter E
so that you can change the error type.
ArgBuilder#build
return an Either
instead of an IO
.BigInt
and BigDecimal
(they return a custom scalar)fieldName
in ExecutionError
for better error diagnosticsGQLInputName
to customize input type namesPublished by ghostdogpr almost 5 years ago
ZStream
but also a function A => ZStream
(#69)Published by ghostdogpr almost 5 years ago
This release brings support for Query Optimization (deduplication, batching), based on a new data type ZQuery
contributed by @adamgfraser.
Imagine the following QraphQL query:
query {
orders { # calls getOrders
id
customer { # calls getCustomer
id
name
}
}
}
Without optimizations, this would result in 1 call to getOrders
followed by N calls to getCustomer
(N being the number of orders). This is commonly referred to as the N+1 Problem. Using ZQuery
, you can provide a function that gets a list of customers from a list of IDs, so that Caliban will only perform 2 calls.
See the full documentation for more information.
Schema#resolve
. It now returns a Step
that describes the computation to perform, instead of an IO
. This was necessary to enable query optimizations.ArgBuilder#mapM
by @sh0heiGQLName
annotations in ArgBuilder
1.0.0-RC16
Published by ghostdogpr almost 5 years ago
nonNull
attribute of fields wrapped in ZIO
and ZStream
.1.0.0-RC15
Published by ghostdogpr about 5 years ago
First official release!
Published by ghostdogpr about 5 years ago
Published by ghostdogpr about 5 years ago