From discussions in in the Kotlin serialization slack channel..
Some APIs offer / require use of PATCH inputs, where you send a PATCH request of the fields you want to change. It could be convenient if we could produce such a delta, given two instances of an object.
data class Bar(val baz: String, val b: Int)
data class Foo(val x: Int, val y: String, val z: Bar)
val first = Foo(5, "y", Bar("a", 10))
val second = Foo(6, "y", Bar("b", 10))
Given the above, we want to produce the json
{
"x": 6,
"z": {
"baz": "b"
}
}
I'm not entirely sure how/if we could achieve it with regular serializers to be honest.
From discussions in in the Kotlin serialization slack channel..
Some APIs offer / require use of PATCH inputs, where you send a PATCH request of the fields you want to change. It could be convenient if we could produce such a delta, given two instances of an object.
Given the above, we want to produce the json
{ "x": 6, "z": { "baz": "b" } }I'm not entirely sure how/if we could achieve it with regular serializers to be honest.