caliban

Functional GraphQL library for Scala

APACHE-2.0 License

Stars
938
Committers
140

Bot releases are hidden (Show)

caliban - v0.4.2

Published by ghostdogpr almost 5 years ago

Release Notes

  • Improvements to ZQuery, including a simplification of DataSource that no longer requires a Service by @adamgfraser. See #160 for details.
  • Fixed the encoding of error messages by @paulpdaniels (#145)
  • Documentation improvements by @phderome
  • Updated akka-stream to 2.6.1
  • Updated fastparse to 2.2.2
  • Updated magnolia to 0.12.6
caliban - v0.4.1

Published by ghostdogpr almost 5 years ago

Release Notes

Structural changes

  • 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.
  • It is now possible to combine 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

Query Analyzers

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]

Other Changes

  • Support for Akka HTTP (#72) by @jona7o
  • Renamed makeRestService to makeHttpService . The old name is still there but deprecated. (#125)
  • Changed builtin schema for java UUID so that it returns ID scalar instead of String (#126) by @mriceron
  • Added builtin schema for Scala Future (#124)
  • Fixed a bug when the same field was queries multiple times using aliases (#115)
caliban - v0.3.1

Published by ghostdogpr almost 5 years ago

Release Notes

  • Added support for UUID (#104)
  • Fixed an issue causing nested input types to be missing during introspection (#101)
  • Moved circe encoders/decoders to the core module with circe as an optional dependency (#102) by @rtimush
  • Added a helper method to make it easier to "inject" something into the ZIO environment when using http4s (#100) by @fokot
  • Added graphiql to the example project (#106) by @fokot
  • Added custom scalars in GraphQL#render (#108)
  • Added a custom error message when a Schema can not be found at compile-time, with a few pointers on how to solve it.
  • Updated magnolia to 0.12.2. This update is recommended as it solves some weird compilation errors.
  • Updated zio-interop-cats to 2.0.0.0-RC10
  • Update http4s to 0.21.0-M6
caliban - v0.3.0

Published by ghostdogpr almost 5 years ago

Release Notes

Partial failures

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.

wrapExecutionWith

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.

Other Changes

  • Made ArgBuilder#build return an Either instead of an IO.
  • Fixed enum values that were incorrectly suffixed by "Input"
  • Added support for BigInt and BigDecimal (they return a custom scalar)
  • Added fieldName in ExecutionError for better error diagnostics
  • Added an annotation GQLInputName to customize input type names
  • Upgraded ZIO to 1.0.0-RC17
caliban - v0.2.1

Published by ghostdogpr almost 5 years ago

Release Notes

  • Support arguments for subscriptions. A subscription field can not only be a ZStream but also a function A => ZStream (#69)
  • Improve performance and reliability of Json encoding in Http4s Adapter (#71)
  • Improved performance by pre-generating the execution plan instead of building it for each query.
caliban - v0.2.0

Published by ghostdogpr almost 5 years ago

Release Notes

Highlights

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.

Other changes

  • Changed the signature of Schema#resolve. It now returns a Step that describes the computation to perform, instead of an IO. This was necessary to enable query optimizations.
  • Added ArgBuilder#mapM by @sh0hei
  • Added missing support for GQLName annotations in ArgBuilder
  • Added a few missing validation rules (see #63)
  • Upgraded ZIO to 1.0.0-RC16
caliban - v0.1.1

Published by ghostdogpr almost 5 years ago

Release Notes

  • Added an interop module to facilitate usage of caliban with cats-effect compatible effect types by @desbo and @yoohaemin . See documentation for usage.
  • Added a macro function to check graphql queries at compile-time. See documentation for usage.
  • Fixed the nonNull attribute of fields wrapped in ZIO and ZStream.
  • Upgraded ZIO to 1.0.0-RC15
caliban - v0.1.0

Published by ghostdogpr about 5 years ago

First official release!

caliban - v0.0.6

Published by ghostdogpr about 5 years ago

caliban - v0.0.5

Published by ghostdogpr about 5 years ago