-
Notifications
You must be signed in to change notification settings - Fork 117
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
Missing features for Scala 3 #296
Comments
Hi, could You elaborate on |
Hi, sure:
sealed trait Node
case class Edge(id: Long, source: Node) extends Node
case class SimpleNode(id: Long) extends Node
test("rerucsive class") {
val res = summon[Show[String, Node]].show(Edge(1, SimpleNode(2)))
println(res)
}
case class MyAnnotation(order: Int) extends StaticAnnotation
case class MyTypeAnnotation(order: Int) extends StaticAnnotation
sealed trait AttributeParent
@MyAnnotation(0) case class Attributed(
@MyAnnotation(1) p1: String @MyTypeAnnotation(0),
@MyAnnotation(2) p2: Int @MyTypeAnnotation(1)
) extends AttributeParent @MyTypeAnnotation(2)
test("capture attributes against params") {
val res = summon[Show[String, Attributed]].show(Attributed("xyz", 100))
assertEquals(res, "Attributed{MyAnnotation(0)}{MyTypeAnnotation(2)}(p1{MyAnnotation(1)}{MyTypeAnnotation(0)}=xyz,p2{MyAnnotation(2)}{MyTypeAnnotation(1)}=100)")
} diff:
|
Hi, sealed trait Node
case class Edge(id: Long, source: Node) extends Node
case class SimpleNode(id: Long) extends Node
object Node:
given Show[String, Node] = Show.derived
test("rerucsive class") {
val res = summon[Show[String, Node]].show(Edge(1, SimpleNode(2)))
println(res)
} In order for recursive structures to work with magnolia for Scala 3, an explicit given is needed. |
Re: recursive types - I think we also need to have them supported if the E.g. I think typeclasses for |
RE: |
That could work, or it could be a method that you can override (depending on ergonomics). It would have to be |
@joroKr21 @KacperFKorban Maybe I'm misunderstanding your proposal, but once the companion object extends the I think we wanted to try a two-level solution, where the |
Yeah I thought that's what we wanted (to configure the derivation itself).
So you mean passing runtime configuration, not compile-time? I guess that is another axis of configuration but it would have to be customisable. |
Yes, e.g. in tapir when deriving the |
Yes, you right, but we haven't implemented it yet. |
Can someone elaborate about |
The problem is that The most obvious fix would be finishing #321, though I'm not sure how to tackle some of the new problems posted there. |
Thanks for answer @KacperFKorban. Is mirror-less approach needed? I wonder if something similar to this |
@kpodsiad that could probably work :) maybe you'd like to try implementing this in magnolia? |
Partial support for value classes (case classes, without type parameters) has been added in #435 |
join
/split
methods (e.g. from Scala 2 - https://github.com/softwaremill/tapir/blob/master/core/src/main/scala/sttp/tapir/generic/internal/SchemaMagnoliaDerivation.scala)The text was updated successfully, but these errors were encountered: