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!