Releases: scalalandio/chimney
v1.8.2
v1.8.1
v2.0.0-M1
Important
Since Chimney got affected by 3.7.0 change in givens resolution we had to analyze the possible ways of fixing the issue.
While there is a temporary workaround the proper fix requires releasing a new major version of the library, which ideally would commit to a new Scala 3 LTS. In the meantime, a milestone 2.0.0 release series is planned. All bug fixes and issues would be still implemented on stable version, and then ported to 2.0.0 milestones, until a proper release could be made.
To make maintanance of 2 lines easier, we extracted
chimney-macro-commons
to a separate repository and decoupled its lifecycle from Chimney's lifecycle - the code is used only in macros and no other library seem to rely on it, so binary incomptible changes to chimney-macro-commons (mandating major version update) should not affect anyone, and it should be safe to just increase minor version of Chimney when updating macro commons.This release is the first milestone of 2.0.0 series.
Changelog:
- rewrite API to not rely on the pattern that breaks in 3.7.0 (#713)
- cleanup the API (#712, #713)
- remove deprecated
withCoproduct
methods - remove
.toPartialResult
since.asResult
is available (since 0.8.5) - rework internal type-level config representation (which should not be used directly, but which has to be publicly visible to work)
- remove
__mergeResultNullable
method (which was documented to not be used but which was publicly visible, or at least package visible due to historical reasons) - fix typo in Protobuf support trait name
- make
com.google.protobuf.ByteString
andcom.google.protobuf.ByteValue
TotallyBuildIterable
s (which are more flexible than just conversion to underlying type) - remove unneeded implicits from java-collections
Map
s' implementation signatures
- remove deprecated
v1.8.0
Important
Since Chimney got affected by 3.7.0 change in givens resolution we had to analyze the possible ways of fixing the issue.
While there is a temporary workaround the proper fix requires releasing a new major version of the library, which ideally would commit to a new Scala 3 LTS. In the meantime, a milestone 2.0.0 release series is planned. All bug fixes and issues would be still implemented on stable version, and then ported to 2.0.0 milestones, until a proper release could be made.
To make maintanance of 2 lines easier, we extracted
chimney-macro-commons
to a separate repository and decoupled its lifecycle from Chimney's lifecycle - the code is used only in macros and no other library seem to rely on it, so binary incomptible changes to chimney-macro-commons (mandating major version update) should not affect anyone, and it should be safe to just increase minor version of Chimney when updating macro commons.This release is the first using a new chimney-macro-commons version.
Changelog:
- failed derivation reports more detailed paths to nested failed transformation (#694)
- deprecate methods removed in 2.0.0 (#735)
- extracted
chimney-macro-commons
to the separate repository (#710) - documentation:
- added cheatsheets section
- describe workaround for change in 3.7.0 givens resolution (#715)
- describe why changes in 3.7.0 affects Chimney and how it will be addressed in Chimney 2.0.0 (#722)
- added dependabot action by @xuwei-k (#728) - thank you for your first contribution!
v1.7.3
Changelog:
- cache some intermediate results during the macro expansion (#691) - feedback (improvement, no change, regression) is appreciated!
- more examples in documentation (#693)
- explanation why some usages lead to infinite recursion
- usage of
Transformer.derive
/Transformer.define
- examples of overrides with
Option
s/Either
s/collections - examples of updating
Option
types when the patch is decoded JSON
v1.7.2
Changelog:
- fix regression in
Patcher
s by @hughsimpson (#687) - update Scala 3 to 3.3.5
- update scala-collection.compat to 2.13.0
v1.7.1
Changelog:
- bugfixes
- increased test coverage for semiautomatic derivation methods and fixed a bug in Scala 3 implementation of
TransformerDefinition.withFallbackFrom
(#685) - enabling macro debugging for a single derivation (rather than globally) is no longer treated as an override changing behavior of some cases (#682)
- fix some rename edge cases broken by 1.6.0 refactor (#683, fixed in #684)
- increased test coverage for semiautomatic derivation methods and fixed a bug in Scala 3 implementation of
- updated documentation
- expanded section on
chimney-macro-commons
(#681) - updated Ducktape section, thanks to the first contrubution of @arainko! (the author of Ducktape) (#679)
- fixed typos in DESIGN.md, thanks to the first contribution of @civilizeddev! (#680)
- expanded section on
v1.7.0
This big release bring some long-awaited features: transformations, which take more than 1 case class
as input (well, not only case class
es 😄 ) and improved Patcher
s which handle: recursive patching, overriding values.
Changelog:
- merging transformations - now it's possible to start transformation DSL with 1 value, and keep adding more values as "fallbacks", so that if the field is not found in the first one, it will be looked for in the second, then third, etc, effectively allowing us to merge several input values into 1 output value (#115, fixed in #614)
- this includes merging several tuples into 1
- and merging several
Option
s orEither
s usingorElse
(opt-in) - and merging several collections using
++
(opt-in) - and more!
- added policies for checking if some source field was not used during transformation, or that some target sealed trait subtype was not matched - (#248, fixed in #614)
- we can set Chimney to fail compilation until we mark some source field explicitly not-used, ditto for sealed subtype
- rewritten
Patcher
s as specialized merging transformations (#538, fixed in #614)- this allowed us to make
Patcher
s recursive (fixing #119) - and take implicit
Patcher
in nested fields (fixing #133) - and made it east to add
withFieldConst
,withFieldComputed
andwithFieldomputedFrom
toPatcher
s (fixing #134) - and, combined with policies, allowed us to ignore some fields in
Patchers
and updating from another instance of the same type (fixing #161 and #57)
- this allowed us to make
- additionally we added (opt-in!) support for using implicit conversions and
<:<
during derivation (#667) - added support for generating transformation out of implicit
F ~> G
in Cats integration (#666) - improved
withFieldComputedFrom
to handle more expected cases (#660) - added/expanded a few sections in our documentation (#657)
- explained how to define transformers between
String
and enums - how to avoid using nested
.into.transform
when we need only 1 - the common issue of how to change the naming convention when decoding JSON and then using Chimney
- expanded Cats section on examples with
parMapN
and similar - updated Ducktape comparison
- explained how to define transformers between
- updated Scala 2.13 to 2.13.16, Scala.js to 1.18.1
With this release I feel that all of my personal ambitions for Chimney has been realized.
v1.6.0
Changelog:
-
now we are testing that macros in Scala 2.13 can read Scala 3 code and vice versa - while people might take it for granted, there are some differences in AST between both versions so support for e.g. default values or
@BeanProperty
requires additional work (done in #647) -
withFieldComputed
/withFieldComputedPartial
can now be used in a version that does NOT take the whole input, and so removes the need for writing nested transformers (done in #650)// before foo.into[Bar] .withFieldComputed(_.baz, foo => f(foo.field)) // cannot just use f, does not work with .everyItem etc .transform // or implicit val inner: Transformer[Field, Baz] = ... foo.into[Bar] .withFieldComputed(_.baz, _.field.transformInto[Baz]) // actually never needed -> withFieldRenamed is enough .transform // now foo.into[Bar] .withFieldComputedFrom(_.field)(_.baz, f) // just f, can be used as ComputedFrom(_.everyItem)(_.everyItem, f) etc .transform
-
flags can be provided not only globally, but for nested scope as well, which further removed any need for nesting transformers (done in #653)
// before foo.into[Bar] .withFieldComputed(_.baz, _.field.into[Baz].enableDefaultValues.transform) .transform // now foo.into[Bar] .withFieldRenamed(_.field, _.baz) .withTargetFlag(_.baz).enableDefaultValues .transform
-
make Path DSL more consistent - now Chimney should handle more overrides where we want to rewrite e.g. from
_.everyItem._1
into_.everyMapKey
,.matchingSome
is consistent with.matching[Some[InferredA]].value
, etc (done in #654) -
for a long time when
.withFieldConstPartial
or.withFieldComputed(something that might throw)
or.withFieldComputedPartial
were used, the errorPath
contained the target field name - if such transformation happens in nesting you would receive an error path likesourceField.nestedSourceField.targetField
which makes no sense. This is changed now, so that the Path would be<const for _.targetField>
,<computed for _.targetField>
orsourceField.anotherSourceField => <computed for _.targetField>
to make it explicit that the failure didn't come from some value in input, but in a value provided explicitly, or returned from a function (done in #655 and #656) -
documentation improvements by @ghostdogpr (#628) - thank you for your first contribution!
v1.5.0
Changelog:
- updated Scala 2.12 to 2.12.20, Scala to 3.3.4, Scala.js to 1.17.0 and Scala Native to 0.5.5
- added the
Result#fromCatchingNonFatal
by @danicheg in #590 - thank you for your first contribution! - fixed some typos by @danicheg in #593
- improved
withFieldRenamed
- now it supports.everyItem
/.everyMapKey
/.everyMapValue
/.matching[Subtype]
/.matchingSome
/.matchingLeft
/.matchingRight
on the source-side of the rename path as well!- done in #616 - added a new Outer Transformers integration - allowing to tell the Chimney how to convert some outer type while Chimney takes care of converting its inner values - and used it to improve the support for Cats' NonEmpty types - fixing #569 in #624
- tested and documented the possibly surprising behavior - that writing to
var
s is enabled with.enableBeanSetters
, and it makes sense! - done in #621 - improvements to
chimney-macro-commons
- module existing since Chimney 0.8.0-M1, which you probably haven't heard about yet:- adding
Type.simplePrint
andDefCache
which should make it easier to use this library for writing other macro libraries (with possibly different use cases than Chimney) - done in #620
- adding
- the first release of
chimney-engine
:- it allows using chimney derivation logic inside your own macros, if what you're trying to do is very close to what Chimney does but when extending it for your use cases requires modifying macros rather than providing an implicit
chimney-engine
has a release cycle tied to core Chimney (meaning the same version), but please consider this API experimental
- bugfix for pattern matcing fall through when the Scala 3's enum parameterless case is lowercased #479 - fixed by @jchyb in #603
- workaround against the bug in the compiler scala/scala3#21672 which would make order of cases in match nondeterministic (breaking cache)- fixed in #623