Closed arainko closed 2 months ago
More examples that should work:
case class Level1(level2: Level2)
case class Level1Dest(level2: Level2)
case class Level2(level3: Level3)
case class Level3(int: Int)
level
.into[Level1Dest]
.transform(
Field.const(_.level2.level3.int, 1)
)
Right now if we try to do this:
we'd be greeted with a pretty cryptic error due to the fact that underneath the covers the plan derived for a
Person
toPerson
transformation is actually just an identity (i.e.ducktape
doesn't create a newPerson
from the ground up since that'd be wasteful).We could actually support that use case if we were to derive a lazy 'alternative' plan when encountering an identity transformation which could then be used when traversing the plan in
PlanConfigurer
which would basically replace the identity transformation with the fallback plan.