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 Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product