Sangria MessagePack marshalling.
SBT Configuration:
libraryDependencies += "org.sangria-graphql" %% "sangria-msgpack" % "<latest version>"
MessagePack does not support BigDecimal
natively. However it supports extension types.
In order to provide BigDecimal
support, sangria-msgpack implements an extension type with type ID 47
. It packs the scale in the first 4 bytes (int) followed by unscaled big integers value. This is the default behaviour, so you don't need any addition import for it.
If you would like to allow sangria-msgpack to pack BigDecimal
values as standard types (big integer and double), then you need to add following import:
import sangria.marshalling.msgpack.standardTypeBigDecimal._
Please use it with caution because it will throw IllegalArgumentException
if number does not fit in big integer or double.
sangria-msgpack is licensed under Apache License, Version 2.0.