`SchemaComparison` from `caliban-tools` does not detect changes in base interfaces
satorg opened this issue · comments
Versions:
- Caliban v2.5.0
- Scala v2.13.12
Minimal example:
import caliban.tools._
import zio._
object ExampleApp extends ZIOAppDefault {
val schema1: String =
"""interface A { x: Int }
|interface B { x: Int }
|
|type C implements A { x: Int }
|""".stripMargin
val schema2: String =
"""interface A { x: Int }
|interface B { x: Int }
|
|type C implements B { x: Int } # NOTE: `C` implements `B` instead of `A`
|""".stripMargin
val schema3: String =
"""interface A { x: Int }
|interface B { x: Int }
|
|type C { x: Int } # NOTE: `C` implements nothing
|""".stripMargin
val loader1: SchemaLoader = SchemaLoader.fromString(schema1)
val loader2: SchemaLoader = SchemaLoader.fromString(schema2)
val loader3: SchemaLoader = SchemaLoader.fromString(schema3)
override def run: Task[Unit] = {
for {
changes12 <- SchemaComparison.compare(loader1, loader2)
changes13 <- SchemaComparison.compare(loader1, loader3)
changes23 <- SchemaComparison.compare(loader2, loader3)
_ <- Console.printLine(s"changes12: $changes12")
_ <- Console.printLine(s"changes13: $changes13")
_ <- Console.printLine(s"changes23: $changes23")
} yield ()
}
}
Expected result:
- all three printed values (
changes12
,changes13
,changes23
) should reflect somehow that the base interface of typeC
is different between either of the schemas involved.
Actual result:
- all three values are printed as empty lists:
changes12: List() changes13: List() changes23: List()
@satorg thanks for reporting this issue. Out of curiosity, is this also an issue with Scala 3?
@kyri-petrou , I've just checked it out. Looks like yes, the same issue for Scala 3.3.1.