discriminator
zio.config.derivation.discriminator
final case class discriminator(keyName: String) extends StaticAnnotation
discriminator can be used for class names, such that the name of the class should be part of the product with keyName as keyName.
Example:
@discriminator("type")
sealed trait FooBar
case class Bar(x: Int) extends FooBar
case class Foo(y: String) extends FooBar
case object Fooz extends FooBar
case class AppConfig(config : FooBar)
corresponds to
config : {
type : Bar
x : Int
}
or
config : {
type: Foo
x: Int
}
or
config : Fooz
If annotation is name instead of discriminator, then name of the case class becomes a parent node
Foo : {
x : Int
}
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait StaticAnnotationclass Annotationclass Objecttrait Matchableclass Any
Members list
In this article