AutomaticMaterialization
For a sealed family (all implementations of a sealed trait or defined explicit union types), this option enables the automatic materialization of handlers for the member types.
If used, make sure it cannot lead to type recursion issue (reason why it's not disabled by default).
import reactivemongo.api.bson.{ BSONDocumentReader, Macros, MacroOptions }
sealed trait Family
case class TypeA(n: Int) extends Family
case class TypeB(s: String) extends Family
case class TypeC(f: Float) extends Family
val reader: BSONDocumentReader[Family] =
Macros.using[MacroOptions.AutomaticMaterialization].reader[Family]
// Automatically/internally materializes the readers for Type{A,B,C}