-
Notifications
You must be signed in to change notification settings - Fork 422
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
[BUG] Validator reference is already set to Product #946
Comments
Actually it happens even without multiple traits: sealed trait Animal {
def name: String
}
object Animal extends AutoDerivation with SchemaDerivation {
implicit val customConfig: CirceConfiguration =
CirceConfiguration.default.withDefaults.withDiscriminator("type")
implicit val codec: Codec[Animal] = deriveConfiguredCodec
implicit val tapirConfig: TapirConfiguration = TapirConfiguration.default.withDiscriminator("type")
// It can't be implicit since recursive derivation fails
val schema: Schema[Animal] = Schema.derived
case class Tiger(name: String) extends Animal
case class Elephant(name: String) extends Animal
case class Dog(name: String, favToy: String, training: Boolean, friends: List[Animal]) extends Animal
case class Cat(name: String, favToy: String, friends: List[Animal]) extends Animal
//Fails:
//case class Mouse(name: String, favToy: String, friends: List[Animal]) extends Animal
//case class Mouse(name: String, favToy: String, friends: List[Animal], flag: Boolean) extends Animal
}
|
Somehow it even allows to have two same case classes but fails on third. final case class Tiger(name: String) extends Animal
final case class Elephant(name: String) extends Animal
final case class Dog(name: String, friends: List[Animal]) extends Animal
final case class Cat(name: String, friends: List[Animal]) extends Animal
final case class Mouse(name: String, friends: List[Animal]) extends Animal // it fails only with this line
|
The derivation cache wasn't cleared at one point. A fix is coming :) |
@adamw that's great, thank you |
Released in 0.17.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tapir version: 0.17.2
Scala version: 2.13.4
Describe the bug
Some strange parts of the code fails with error:
How to reproduce?
Project with example (specific branch in repo for it): https://github.com/DenisNovac/tapir-schema-test/tree/multilevel-traits-adt
Animal (https://github.com/DenisNovac/tapir-schema-test/blob/multilevel-traits-adt/src/main/scala/Animal.scala):
The text was updated successfully, but these errors were encountered: