sangria v0.4.0 Release Notes
Release Date: 2015-09-27 // over 8 years ago-
๐ This release contains quite a few backwards-incompatible changes, but fear not - all of them are renames and similar minor changes which should be easy to migrate. I collected all of them in the change list below. They were necessary in order to ensure consistent naming and improve the structure and flexibility of the library.
- 0๏ธโฃ #68 - Better handling of default input values. It's a part of ongoing effort to improve handling of input objects (#37). Default values should now have an instance
of
ToInput
type-class which is defined for all supported input types like scala map-like data structures, different json ASTs, etc. It even supports things likeWrites
from play-json orJsonFormat
from spray-json by default. This means that you can use your domain objects (likeUser
orApple
) as a default value for input fields or arguments as long as you haveWrites
orJsonFormat
defined for them. The mechanism is very extensible, of course: you just need to define implicitToInput[T]
for a class you want to use as a default value. This change makes it impossible to verify the default value type at compile time, since it can have any shape, like Json AST or maybe even some binary format. Don't worry though, at a schema creation time all default values would be validated according to the input type. - ๐ #77 - Middleware support. This addition has a huge potential: you can measure performance, collect metrics, enforce security, etc. on a field and query level. Moreover
it makes it much easier for people to share standard middleware in a libraries (e.g. sangria-security, sangria-graphite, sangria-influxdb, etc.). In order to ensure generic classification of
fields, every field now got a generic list or
FieldTag
s which allow to provide user-defined meta information about this field (just to highlight a few examples:Permission("ViewOrders")
,Authorized
,Measured
, etc.). You can find more info in docs and auth example - ๐ #76 - You can now provide
maxQueryDepth
toExecutor
. It will then enforce this constraint for all queries (very useful if query has recursive types) Docs - #69 -
DeferredResolver
now gotuserContext
as an argument. (breaking change: you need to provide a type parameter and one extra argument inresolve
for yourDeferredResolver
s. you you are not interested inuserContext
, you can just useAny
type) - ๐ Renamed Json support objects in order to make more concise import syntax (breaking change: you need to rename imports as well):
sangria.integration.CirceSupport
->sangria.integration.circe
sangria.integration.Json4sSupport
->sangria.integration.json4s
sangria.integration.PlayJsonSupport
->sangria.integration.playJson
sangria.integration.SprayJsonSupport
->sangria.integration.sprayJson
- ๐ฆ
ResultMarshaller
andInputUnmarshaller
are moved in theintegration
package - ๐ Renamed execution
arguments
tovariables
in order to be consistent with the spec (breaking change: you need to rename this argument as well, if you are using named arguments) - ๐จ Refactored variables and
InputUnmarshaller
. In order to avoid extra complexity it now does not have a dependent type. Instead it uses "type tagging" for scala map variables. It's a minor breaking change. If you are providing execution variables as a scala map, then you need to usemapVars
oremptyMapVars
which are defined inInputUnmarshaller
companion object (these functions do not wrapMap
- they only needed to ensure type constraints): ```scala Executor.execute(mySchema, query, variables = mapVars(Map("someId" -> "1000")))
// or
Executor.execute(mySchema, query, variables = mapVars("someId" -> "1000"))
* #72 - `scala.util.Try` now can be returned from `resolve` in order to indicate a successful or failed result * ๐ #65 - `DeprecationTracker` should be called even if deprecation is in the interface type * โก๏ธ #66 - `DeprecationTracker` should provide more contextual information (breaking change: the signature of `deprecatedFieldUsed` is changed. It now provides much more contextual information, but you need to update the code that implements it) * #74 - Improved unicode handling (spec change) * #67 - circe integration throws NoSuchElementException during execution * #75 - Identical documents should be equal * #73 - Verify input field uniqueness (spec change - new validation rule) * ๐ Minor bugfixes
- 0๏ธโฃ #68 - Better handling of default input values. It's a part of ongoing effort to improve handling of input objects (#37). Default values should now have an instance
of