Closed lihaoyi closed 6 months ago
I'd be happy to take a stab at this @lihaoyi
Is it okay if the LegacyApi
continues to use $type
for the discriminator and only upickle.default
uses the new behavior?
IIRC the legacy one doesnt use a key value discriminator at all; instead, it wraps things jn two element arrays
But yeah, I think in general focusing on making it work for upickle.default is fine.
Given a
"$type": "foo.Bar"
sealed trait discriminator, Custom Keys's@key
annotation allows you to replace the right hand side"foo.Bar"
of a particularcase class
by annotating thecase class
, but it does not allow you to replace to left hand side"$type"
string with something else.This ticket is to implement the ability for a user to replace
$type"
with some other string, by annotating thesealed trait
itself with@key("myType")
annotation that would replace"$type"
with"myType"
for all sub-classes of thesealed trait
.To incentivize contribution, I'm putting a 500USD bounty on resolving this ticket. This is payable via bank transfer, and at my discretion in case of ambiguity.