Skip to content

Releases: AVSystem/scala-commons

v2.0.0

25 May 20:38
Compare
Choose a tag to compare
  • Added support for Scala 2.13 and dropped support for Scala 2.11
  • GenCodec creates a List instead of Vector when deserializing scala.collection.Seq or scala.collection.immutable.Seq #76
  • commons-annotations module removed, annotations moved to commons-core
  • removed commons-rest, commons-akka and commons-kafka
  • AnnotationAggregate redesigned to use aggregated method rather than dummy type member
  • aliases for Annotation and StaticAnnotation in CommonAliases
  • Async moved from RawRest into concurrent package
  • declareSize, sizePolicy for Outputs and knownSize for Inputs

v1.34.0

06 Nov 15:22
Compare
Choose a tag to compare

REST framework:

  • REST framework has been superseded by udash-rest and deprecated. For backwards compatibility, it has been moved to separate, cross compiled module, commons-rest.

Changes in GenCodec (breaking)

  • Extracted SimpleOutput from Output and SimpleInput from Input - this primarily makes writing wrappers easier. For wrapping, convenience abstract classes have been implemented.
  • isNull removed from Input. Instead, readNull() returns Boolean to indicate whether there was null or not.
  • Introduced readCustom and writeCustom as a more principled way Input and Output implementations may support custom native values like ObjectId.
  • Introduced InputMetadata which may be used by Input and Output implementations to provide additional information to codecs, e.g. JsonType by JsonStringInput.
  • Introduced GenObjectCodec as a public sub-typeclass of GenCodec. It has materialize, HasGenObjectCodec etc.

Changes in RedisDriver (breaking)

  • Full support for Redis 5, including streams
  • Blocking commands can now be executed on RedisNodeClient and RedisClusterClient thanks to a separate connection pool maintained by RedisNodeClient for them
  • Simplified type parameterization of Redis API variants by introducing RedisSerialization
  • HashKey type member is renamed to Field
  • Redis APIs are now parameterized also by Record type which has a separate RedisRecordCodec serialization typeclass which can be derived from GenObjectCodec. Records are used in Redis hash and stream commands.
  • RedisDataCodec no longer uses StreamOutput/Input - simple values are serialized as plain strings while complex values are serialized to JSON before being sent to Redis. This is a major breaking change in serialization format used by Redis driver to save Scala types into Redis.
  • RetryStrategy is now more composable
  • Handling of TRYAGAIN Redis Cluster errors with configurable retry strategy
  • Changes in ClusterConfig - primarily new retry strategies

v1.33.2

22 Oct 13:10
Compare
Choose a tag to compare
  • REST framework: header parameter names are case insensitive when reading from RestRequest
  • allowed vals and vars in macro instances
  • metadata classes can now have filters of their own (e.g. @annotated) - previously it was only possible to specify them on metadata parameters

v1.33.1

17 Oct 14:35
Compare
Choose a tag to compare
  • MacroInstances no longer requires methods in Instances trait to be parameterless
  • introduced @allowIncomplete meta-annotation for metadata classes which makes it possible to materialize partial metadata for RPCs and ADTs
  • various minor convenience methods and implicits

v1.33.0

16 Oct 12:46
Compare
Choose a tag to compare
  • usage of MacroCommons from commons-macros no longer requires commons-annotations or commons-core in classpath of macro callsites (breaking for client classes extending MacroCommons)
  • introduced typeclasses for capturing annotations: AnnotationOf, AnnotationsOf, OptAnnotationOf and implicits for capturing self-annotations into super constructor arguments: SelfAnnotation, SelfAnnotations, SelfOptAnnotation
  • simplification/generalization of RpcMacroInstances into RPC-independent MacroInstances (breaking)
  • added missing example field into OpenAPI Schema in REST framework (breaking)
  • improved/fixed annotation processing by properly substituting type parameters of annotations
  • dropped RpcImplicitsProvider, instead one should rely on implicit injection through MacroInstances into companion objects (breaking)
  • GenCodecMacros now use the same implicit resolution & caching engine as RPC/ADT metadata macros
  • RestStructure refactored/simplified (breaking)

v1.32.0

01 Oct 14:24
Compare
Choose a tag to compare

Changes in RPC/ADT macro engines:

  • @reifyEncodedAnnot removed, allowed @composite parameters to be @optional instead
  • introduced @reifyDefaultValue for reifying Scala-level default values of case class fields
  • introduced overloadedOnly flag for @rpcNamePrefix which causes it to be used only for overloads of RPC methods
  • introduced ImplicitNotFound typeclass for customizing implicit-not-found compilation errors for arbitrary types

REST framework:

  • support for headers in HTTP responses (requires custom serialization to RestResponse)
  • automatic handling of HEAD and OPTIONS requests
  • operationId in generated Operation objects now defaults to RPC methods plain name, without the HTTP method prefix (e.g. soSomething instead of post_doSomething) unless the method is overloaded.
  • nicer compilation error messages for various missing REST-related implicits
  • @operationIdPrefix annotation for prefix methods
  • operation adjusters can now be specified for prefix methods - will apply to all operations under a prefix method
  • introduced new type of adjuster: PathItemAdjuster for adjusting OpenAPI PathItem objects
  • introduced new adjuster annotations: @operationId, @nullable, @tags, @bodyDescription, @responseDescription, @pathDescription, @summary, @pathSummary, @title, @schemaDescription
  • configurable async context timeout and buffer size for Jetty-based client & server
  • OpenAPI generation now accepts predefined Components
  • various minor fixes and improvements

GenCodec:

  • compilation errors raised for missing dependencies are positioned on case class parameters which cause these errors
  • GenCodec.Auto removed

v1.31.0

19 Sep 16:13
Compare
Choose a tag to compare

Changes in REST framework:

  • support for application/x-www-form-urlencoded through @FormBody annotation on REST methods
  • OpenApi now supports arbitrary JSON values for default values in schemas, enums and examples
  • Default values from @whenAbsent annotation on method parameters and case class parameters are included into generated OpenAPI documents
  • @example annotation for REST parameters to define example values later included into OpenAPI document

Other changes:

  • MacroGenerated now accepts typed companion which may inject implicits into macro materialization
  • Applier and Unapplier typeclasses
  • annotations materialized using @reifyAnnot and @reifyEncodedAnnot can accept parameters annotated as @infer which will be inferred by macro engine as implicits

v1.30.0

14 Sep 13:09
1301708
Compare
Choose a tag to compare

Changes in REST framework:

  • Added support for OpenAPI 3.0 specification generation
  • DefaultRestApiCompanion and DefaultRestServerApiCompanion require materialization of OpenApiMetadata which requires RestSchema instances for data types used in REST API traits.
  • 204 No Content status code is used for empty responses instead of 200 OK.

Changes in RPC macro engine:

  • introduced metadata generation for ADTs (algebraic data types)
  • extracted common RPC & ADT meta-annotations to meta package from rpc package and renamed some of them
  • RPC method declaration order is honored, first matching raw method is taken
  • @annotated[A] filtering meta-annotation for RPC methods and parameters
  • metadata parameters now must always be annotated to tell the macro engine how to materialize them - introduced @rpcMethodMetadata, @rpcParamMetadata, @adtCaseMetadata and @adtParamMetadata meta-annotations
  • metadata parameters now have limited support for sealed hierarchies of metadata classes

Other changes:

  • JsonOptions now aggregates some of its fields in JsonFormatting object, added afterColon formatting option
  • commons-annotations module now depends on commons-macros
  • JSON serialization improvements by @plokhotnyuk - #83
  • various new extension methods in SharedExtensions

v1.29.1

04 Sep 09:52
Compare
Choose a tag to compare
  • configurable AsyncContext timeout in JettyRPCFramework
  • async higher order extensions for collections
  • worked around a compiler bug where sealed hierarchy computation in macros didn't work for some traits loaded from classfiles

v1.29.0

25 Jul 12:44
Compare
Choose a tag to compare

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