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)
This PR fixes the decoding failure of discriminated case objects.
Example
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