Redundant fields in patchersΒΆ

When patch case class contains a field that does not exist in patched object, Chimney will not be able to generate patcher.

case class User(id: Int, email: String, phone: Long)
case class UserUpdateForm(email: String, phone: Long, address: String)

val user = User(10, "", 1234567890L)

user.patchUsing(UserUpdateForm("", 123123123L, "some address"))
// Field named 'address' not found in target patching type User

This default behavior is intentional to prevent silent oversight of typos in patcher field names.

But there is a way to ignore redundant patcher fields explicitly with .ignoreRedundantPatcherFields operation.

  .using(UserUpdateForm2("", 123123123L, "some address"))
// User(10, "", 123123123L)

Patching succeeded using only relevant fields that appears in patched object and ignoring address: String field from patch.