Is there a way to require the type-discriminator's presence during serialization, even if the serialization case doesn't actually need discriminating?
That is, I'm putting a specific member of a sealed class inside a sealed class, and, for the API's sake, I want to include the
type
key, but if I type the field in the data class to the specific sealed class member, it just serializes the different properties and does not include the type discriminator (by design, surely - but I'm hoping to avoid it anyways)
Paul Griffith
10/26/2020, 11:45 PM
encodeDefaults
won't work, because I have lots of other nullable things that I don't want to send over the wire. I'm guessing the solution will be a custom serializer for as many of these sometimes-discriminated-sometimes-not members as I have
Paul Griffith
10/27/2020, 5:56 PM
For posterity, this is the best I've come up with.