github AVSystem/scala-commons v1.29.0

latest releases: v2.20.0, v2.19.0, v2.18.0...
6 years ago

Primary motivation for this release is RPC based REST framework
The biggest breaking change is change of serialization format used by GenCodec for Option - migrate carefully!

Changes in RPC framework itself (mostly inspired or needed by REST framework):

  • Raw parameters and metadata parameters may be grouped into classes using @composite
  • Method RPC name no longer needs to be the only parameter in first parameter list of @multi raw methods. Now it can appear anywhere in the raw method signature but it must be explicitly marked as @methodName. It may also be inside a @composite parameter.
  • @methodTag and @paramTag now accept default tag value instead of type. This value is injected as effective annotation on real methods/params so there's no need to worry about default tags in annotation processing.
  • @tagged now accepts whenUntagged parameter containing tag value assumed when real method/param is untagged. This fallback tag value is also injected as effective annotation on real method/param.
  • Brought back requirement that RPC name must be unique among all methods in RPC trait and among all parameters in RPC method.
  • Introduced @rpcNamePrefix which may be aggregated by method/param tags to effectively allow overloading RPC methods as long as they have different tags.
  • Introduced @tried - raw method annotation which causes results of real methods to be automatically wrapped into Try. This catches possible exceptions thrown by real methods and makes it possible to handle them during serialization to raw values.
  • Implemented reusable infrastructure for easy creation of base companion classes for RPC traits.
  • RPC framework now understands @transientDefault on RPC method parameters
  • Raw methods in RPCFramework (legacy RPC) now accept a single RawInvocation parameter that aggregates method name and argument list.

Changes in annotation processing:

  • Introduced @defaultsToName meta-annotation for String-typed annotation parameters.

Changes in serialization (mostly breaking, #74):

  • Option no longer serializes to a list - it uses the same format as Opt, i.e. None is represented as null and Some(null) is indistinguishable from None - it will deserialize as None. Input and Output implementations may fall back to the old list-based format by overriding legacyOptionEncoding method.
  • JsonStringInput and JsonStringOutput now accept JsonOptions - #66. Default serialization of timestamps has changed to emit ISO-formatted UTC-based millisecond-precision timestamp string. Default serialization of byte arrays has changed to emit JSON arrays of numbers instead of HEX strings.
  • Removed InputType and replaced it with simple isNull method on Input
  • @transparent codecs now delegate null deserialization to its underlying codec instead of returning bare null value.

Other unrelated features:

  • Introduced general purpose Timestamp class
  • JettyRPCFramework client now accepts responses bigger than 2MiB - #77

Don't miss a new scala-commons release

NewReleases is sending notifications on new releases.