This PR fixes the decoding failure of discriminated case objects.

Example

@discriminatorName("type")
enum Foo derives Schema:
case Bar(b: Int)
case Baz
JsonCodec.jsonDecoder(Schema[Foo]).decodeJson("""{ "type": "Baz" }""")

It also makes case object decoding respect @rejectExtraFields.

However, currently @rejectExtraFields can be applied only to the leaf nodes of ADTs, not the sealed trait/enum itself. To fix this, we need to propagate the parent schema to every caseClassN decoder, but it’s out of the scope of this PR. (#700)

/claim #711

Claim

Total prize pool $125
Total paid $125
Status Approved
Submitted August 06, 2024
Last updated August 11, 2024

Contributors

JI

Jisoo Park

@guersam

100%

Sponsors

ZI

ZIO

@ZIO

$125 paid