Releases: AVSystem/scala-commons
v1.31.0
Changes in REST framework:
- support for
application/x-www-form-urlencodedthrough@FormBodyannotation on REST methods OpenApinow supports arbitrary JSON values for default values in schemas, enums and examples- Default values from
@whenAbsentannotation on method parameters and case class parameters are included into generated OpenAPI documents @exampleannotation for REST parameters to define example values later included into OpenAPI document
Other changes:
MacroGeneratednow accepts typed companion which may inject implicits into macro materializationApplierandUnappliertypeclasses- annotations materialized using
@reifyAnnotand@reifyEncodedAnnotcan accept parameters annotated as@inferwhich will be inferred by macro engine as implicits
v1.30.0
Changes in REST framework:
- Added support for OpenAPI 3.0 specification generation
DefaultRestApiCompanionandDefaultRestServerApiCompanionrequire materialization ofOpenApiMetadatawhich requiresRestSchemainstances for data types used in REST API traits.204 No Contentstatus code is used for empty responses instead of200 OK.
Changes in RPC macro engine:
- introduced metadata generation for ADTs (algebraic data types)
- extracted common RPC & ADT meta-annotations to
metapackage fromrpcpackage 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,@adtCaseMetadataand@adtParamMetadatameta-annotations - metadata parameters now have limited support for sealed hierarchies of metadata classes
Other changes:
JsonOptionsnow aggregates some of its fields inJsonFormattingobject, addedafterColonformatting optioncommons-annotationsmodule now depends oncommons-macros- JSON serialization improvements by @plokhotnyuk - #83
- various new extension methods in
SharedExtensions
v1.29.1
v1.29.0
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
@multiraw 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@compositeparameter. @methodTagand@paramTagnow 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.@taggednow acceptswhenUntaggedparameter 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
@rpcNamePrefixwhich 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 intoTry. 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
@transientDefaulton RPC method parameters - Raw methods in
RPCFramework(legacy RPC) now accept a singleRawInvocationparameter that aggregates method name and argument list.
Changes in annotation processing:
- Introduced
@defaultsToNamemeta-annotation forString-typed annotation parameters.
Changes in serialization (mostly breaking, #74):
Optionno longer serializes to a list - it uses the same format asOpt, i.e.Noneis represented asnullandSome(null)is indistinguishable fromNone- it will deserialize asNone.InputandOutputimplementations may fall back to the old list-based format by overridinglegacyOptionEncodingmethod.JsonStringInputandJsonStringOutputnow acceptJsonOptions- #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
InputTypeand replaced it with simpleisNullmethod onInput @transparentcodecs now delegatenulldeserialization to its underlying codec instead of returning barenullvalue.
Other unrelated features:
- Introduced general purpose
Timestampclass JettyRPCFrameworkclient now accepts responses bigger than 2MiB - #77
v1.28.3
v1.28.2
Introduced TypeString and JavaClassName - platform-independent, serializable, macro-generated typeclasses that hold full textual representation of a Scala type (TypeString) and fully qualified class name of a Java class corresponding to a Scala type (JavaClassName).
v1.28.1
- Introduced
SealedUtils.instancesFormacro which lists instances of some typeclass for every case class (non-abstract subclass) of a sealed hierarchy - Introduced
@showAstannotation which works similarly to.showAstextension macro but can be used on definitions (classes, objects, members) instead of just expressions. However, it requirescommons-analyzercompiler plugin to be enabled.
v1.28.0
Generalized RPC framework - #57
This is an overhaul of RPC macro engine and overall RPC design. Compatibility with previous version is not preserved but RPCFramework is kept as legacy glue code. Porting old usages of RPCFramework to new version should be relatively easy as incompatibilities are not big:
- Signature of raw methods (
fire,callandget) has changed - it takes RPC name in separate parameter list and arguments asList[RawValue]instead ofList[List[RawValue]] RPCMetadataAPI changed - there is separate metadata map for every method type (procedure, function, getter).
Changes in GenCodec and serialization
Breaking changes:
HasGenCodecredesigned.MacroCodec[T]removed in favor orMacroGenerated[GenCodec[T]].HasGenCodecis now more flexible - previously it didn't work for case classes with default parameter values or sealed traits with subclasses in companion object. This was caused by overzealous validation done by the compiler on super constructor arguments - they cannot refer to the object being constructed. Materialization ofMacroGeneratedis now able to work around this.GenCodec.Autohas been deprecated and will be removedInputandOutputnow supportBigIntandBigDecimalnatively - #69
Other changes:
v1.27.8: Merge branch 'redis-init-rc-fix' into HEAD
Fixed race condition in RedisClusterClient initialization that caused it to sometimes not initialize at all.