We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, thank you for a cool project!
I've encountered the issue with resolving implicits, here is somewhat minimal case reproducing error in header:
trait Res[+A] extends Product { def code: Res.Code } object Res { sealed trait Code final case object Succ extends Code final case object Fail extends Code final case class Ok[A](data: A, code: Code = Succ) extends Res[A] final case class Error[A](message: String, code: Code = Fail) extends Res[A] } final case class Item(name: String) package object implicits { import tethys._ import tethys.jackson._ import tethys.derivation.semiauto._ implicit val itemReader: JsonReader[Item] = jsonReader[Item] implicit val itemWriter: JsonObjectWriter[Item] = jsonWriter[Item] implicit def resReader[A: JsonReader]: JsonReader[Res[A]] = JsonReader.builder .addField[String]("code") .selectReader[Res[A]]{ case "SUCCESS" => JsonReader.builder.addField[A]("data").buildReader(Res.Ok[A](_)) case "FAILURE" => JsonReader.builder.addField[String]("message").buildReader(Res.Error[A](_)) } implicit def okWriter[A: JsonObjectWriter]: JsonObjectWriter[Res.Ok[A]] = JsonWriter.obj[Res.Ok[A]] .addField("code")(_ => "SUCCESS") .addField("data")(_.asJson) implicit val errorWriter: JsonObjectWriter[Res.Error[_]] = JsonWriter.obj[Res.Error[_]] .addField("code")(_ => "FAILURE") .addField("message")(_.message) } ... >>> Ok(List(Item("a"), Item("b"))).asJson ... > diverging implicit expansion for type tethys.JsonWriter[List[io.expload.api.Item]]
The text was updated successfully, but these errors were encountered:
@sherzodv that example is not correct because okWriter requires JsonObjectWriter for A and List does not have it
Do you have better example to reproduce this issue?
Sorry, something went wrong.
eld0727
No branches or pull requests
Hi, thank you for a cool project!
I've encountered the issue with resolving implicits, here is somewhat minimal case reproducing error in header:
The text was updated successfully, but these errors were encountered: