dynosaur
dynosaur copied to clipboard
Fail on the non-exhausted oneOf schema
Maybe we can find a way to fail on compilation if user provided non-exhaustive ADT legs
sealed trait Foo
case class A extends Foo
case class B extends Foo
case class C extends Foo
val schema : Schema[Foo] = Schema.oneOf[Foo]{alt =>
val schemaA : Schema[A] = ???
val schemaB : Schema[B] = ???
alt(schemaA) |+| alt(schemaB) // fail to compile here, because missing schemaC
}
This is documented as a limitation, it would be nice if it could be prevented, but I don't really see an easy solution