Hi, thank you for this great library!
I'm curious if you would consider adding an option to always derive enums as if they were sealed traits/sealed abstract classes? That is, even a simple enum with only singleton cases would still produce a JSON object and could be configured with AdtEncodingStrategy.
For example:
import io.bullet.borer.{Encoder, Json}
import io.bullet.borer.derivation.MapBasedCodecs.*
enum Foo derives Encoder {
case Bar
}
Json.encode(Foo.Bar).toUtf8String // "Bar"
sealed trait Baz derives Encoder.All
object Baz {
case object Quux extends Baz
}
Json.encode(Baz.Quux: Baz).toUtf8String // {"Quux":{}}
I would like Json.encode(Foo.Bar) to produce {"Baz":{}} so I can use enums and sealed traits interchangeably
Hi, thank you for this great library!
I'm curious if you would consider adding an option to always derive
enums as if they weresealed traits/sealed abstract classes? That is, even a simpleenumwith only singletoncases would still produce a JSON object and could be configured withAdtEncodingStrategy.For example:
I would like
Json.encode(Foo.Bar)to produce{"Baz":{}}so I can useenums andsealed traits interchangeably