Skip to content

Instantly share code, notes, and snippets.

@LightSystem
Created September 13, 2024 13:48
Show Gist options
  • Save LightSystem/3fe145cd0aa972b404bd6ff9f83dce86 to your computer and use it in GitHub Desktop.
Save LightSystem/3fe145cd0aa972b404bd6ff9f83dce86 to your computer and use it in GitHub Desktop.
Circe Codec derivation with discriminator
import io.circe.Codec
import io.circe.derivation.Configuration
enum DiscriminatorCodecEnum derives Codec:
case A(field: String)
case B(field: String)
object DiscriminatorCodecEnum:
given Configuration = Configuration(discriminator = Some("type"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment