Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@kostaskougios

Description

@kostaskougios

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions