Scala 3 different schema derivation enum names
guymers opened this issue · comments
Sam Guymer commented
The following produces a different schema depending on the Scala version:
@GQLName("PrefixOperator")
sealed trait Operator
object Operator {
@GQLName("PrefixOperatorGreaterThan")
case object GreaterThan extends Operator {
implicit val schema: Schema[Any, GreaterThan.type] = Schema.gen
}
@GQLName("PrefixOperatorLessThan")
case object LessThan extends Operator {
implicit val schema: Schema[Any, LessThan.type] = Schema.gen
}
implicit val schema: Schema[Any, Operator] = Schema.gen
}
case class Queries(
op: Operator,
)
object Queries {
implicit val schema: Schema[Any, Queries] = Schema.gen
}
val schema = {
val queries = Queries(op = Operator.LessThan)
caliban.graphQL(RootResolver(queries))
}
Scala 2:
schema {
query: Queries
}
enum PrefixOperator {
PrefixOperatorGreaterThan
PrefixOperatorLessThan
}
type Queries {
op: PrefixOperator!
}
Scala 3:
schema {
query: Queries
}
enum PrefixOperator {
GreaterThan
LessThan
}
type Queries {
op: PrefixOperator!
}
kyri-petrou commented
Thanks for reporting these issues - our Scala 3 derivation uses Scala 3's built-in generic derivation instead of Magnolia. While this gives us more flexibility, it also means that we have a few inconsistencies / small bugs in some edge cases
Sam Guymer commented
No worries, thanks for the fixing them so quickly.