chimney icon indicating copy to clipboard operation
chimney copied to clipboard

Nested patchers don't work with subset of fields

Open joroKr21 opened this issue 4 years ago • 1 comments

It's ok to patch a subset of fields on the top level, but not on deeper levels.

  import io.scalaland.chimney.dsl._
  case class Foo(x: Int, y: String)
  case class FooPatch(x: Int)
  case class Bar(foo: Foo, z: Long)
  case class BarPatch(foo: FooPatch)
  val foo = Foo(1, "2")
  val bar = Bar(foo, 3)
  val fooPatch = FooPatch(4)
  val barPatch = BarPatch(fooPatch)
  foo.patchWith(fooPatch) // ok
  bar.patchWith(barPatch) // y: java.lang.String - no accessor named y in source type FooPatch

Awesome library btw :+1:

joroKr21 avatar Oct 28 '19 00:10 joroKr21