Automatic derivation of Codec for Scala 3 union types
Open
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.5k
- Forks
- 546
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 1
Description
It would be great if Circe could automatically derive Encoder/Decoder for Scala union types, for example,
given [A: Decoder, B: Decoder]: Decoder[A | B] =
Decoder[A] or Decoder[B].widen
given [A: Encoder, B: Encoder]: Encoder[A | B] =
Encoder.instance:
case a: A => Encoder[A].apply(a)
case b: B => Encoder[B].apply(b)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by locating Circe's Scala 3 derivation entry points and existing Encoder/Decoder derivation, then compare their behavior with the requested union-type examples; done means automatic Encoder and Decoder instances work for Scala 3 union types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100