v4.0.0-RC14
afsalthaj
released this
23 Mar 05:20
·
75 commits
to series/4.x
since this release
Updates
- Add type-discriminator support for scala-3 auto derivation. Note that this support already existed in scala-2 auto derivation
import zio.config._, magnolia._, typesafe._
@nameWithLabel("type")
sealed trait FooBar
case class Foo(name: String) extends FooBar
case class Bar() extends FooBar
case class MyConfig(a: FooBar, b: FooBar)
val hocon =
s"""
{
a : {
type : Foo
name : baz
},
# Bar is just name since it has no fields, and therefore no need of type descriminator
b : Bar
}
"""
ConfigProvder.fromHoconString(hocon).load(deriveConfig[MyConfig])
Find more examples here: