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

No support for recursive case classes (in scala 3)? #844

Open
kostaskougios opened this issue Jul 28, 2024 · 0 comments
Open

No support for recursive case classes (in scala 3)? #844

kostaskougios opened this issue Jul 28, 2024 · 0 comments

Comments

@kostaskougios
Copy link

kostaskougios commented Jul 28, 2024

For example this code doesn't compile (scala 3.4.2):

import com.sksamuel.avro4s.*

final case class Part(
    id: Int,
    children: Seq[Part]
)

I can make it compile like below but then it gets stuck during runtime due the recursively trying to evaluate the schema for Part:

package world.serializer

import com.sksamuel.avro4s.*

final case class Part(
    id: Int,
    children: Seq[Part]
)
given SchemaFor[Part] = SchemaFor[Part]

@main
def tryit() =
  println("Start")
  println(SchemaFor[Part].schema)
  println("Done")

I've read the "Recursive ADT" part of the readme file but don't understand if I've to provide encoders/decoders always or only if I need to customize serialization, it is a bit unclear.

Can someone please clarify what is wrong with this?

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

1 participant