Open masonedmison opened 2 years ago
Does diffx support modification of nested case class parameters?
It should. This is definitely a bug. Thanks for reporting.
Released as 0.8.1
There is some problem with sonatype:
[189/243] Execution failed: [404: Not Found] Request failed: {"errors":[{"id":"*","msg":"No activity for repository: comsoftwaremill-1133"}]}
The release will probably fail. I will retry it later in the evening.
It's also possible that the release succeeded, but the job failed. Better to check on central if it's there :)
Good news, it does look like the release succeeded, I am able to pull it from maven central in my build.sbt. Not so good news, though the error is no longer thrown, it still doesn't look like things work as expected.
For example (substituting the diff
function from the example above),
def diff(other: Person) = {
val add =
Diff.summon[Address]
.ignore(_.house)
val d =
Diff.summon[Person]
.modify(_.address)
.setTo(add)
d.apply(this, other)
}
and running the example
val a1 = Address(123, "Robin St.")
val a2 = Address(456, "Robin St.")
val p1 = Person("Mason", a1)
val p2 = Person("Mason", a2)
println {
p1.diff(p2).isIdentical
}
prints false
when I would expect this to print true
.
We clearly miss some test cases for those. Thanks I will look into that.
All good, let me know if there is anything I can do to help :)
I found a fix for your case but I also dig a little bit more into that issue and I found countless other edge-cases that would not work even we this new fix applied. This is a design problem and I need to think about that more...
I released another fix as 0.8.2 It should solve your problem but that is not a complete solution to that issue as there are still some edge cases where it will not work. I have an idea how to fix it completely but I need to rethink how to approach it.
Given the following simple example:
we are receiving the following stack trace
Does
diffx
support modification of nested case class parameters? If I instead provideDiff.useEquals[Address]
instead of the automically derived instance, the example runs successfully.