Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail on the non-exhausted oneOf schema #16

Open
semenodm opened this issue May 2, 2022 · 1 comment
Open

Fail on the non-exhausted oneOf schema #16

semenodm opened this issue May 2, 2022 · 1 comment

Comments

@semenodm
Copy link

semenodm commented May 2, 2022

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
}
@SystemFw
Copy link
Owner

This is documented as a limitation, it would be nice if it could be prevented, but I don't really see an easy solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants