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

could not find implicit value for parameter helper: ai.x.play.json.OptionValidationDispatcher[Option[Seq[com.company.project.JsonFormats.Test]]] #88

Open
wkurkian opened this issue Apr 30, 2021 · 2 comments

Comments

@wkurkian
Copy link

It seems like Option[Seq[T]] isn't handled by Jsonx.formatCaseClass.

Here is code I used to reproduce it:

import ai.x.play.json.implicits.optionWithNull
case class Test(value: String, and: Option[Seq[Test]])
implicit val testFormats = Jsonx.formatCaseClass[Test]

Here is the full error message:

could not find implicit value for parameter helper: play.api.libs.json.Reads[Option[Seq[com.company.project.JsonFormats.Test]]]
TRIGGERED BY: could not find implicit value for parameter helper: ai.x.play.json.OptionValidationDispatcher[Option[Seq[com.company.project.JsonFormats.Test]]]
TO SOLVE THIS
1. Make sure there is a Reads[Option[Seq[com.company.project.JsonFormats.Test]]] or Format[Option[Seq[com.company.project.JsonFormats.Test]]] in the implicit scope
2. In case of Reads[Option[...]] you need to either
   import ai.x.play.json.implicits.optionWithNull // suggested
   or
   import ai.x.play.json.implicits.optionNoError // buggy play-json 2.3 behavior
3. In case of Reads[... .type]
   import ai.x.play.json.SingletonEncoder.simpleName
   import ai.x.play.json.implicits.formatSingleton

  implicit val testFormats = Jsonx.formatCaseClass[Test]

Is there some workaround to tell formatCaseClass how to handle this case?

@caente
Copy link
Contributor

caente commented Apr 30, 2021

this is possibly related to #58

@wkurkian
Copy link
Author

@caente Thanks, I see what you suggested for that one. This behavior works correctly using play json, the reason I am trying to use this lib instead is to support case classes larger than 22 fields.

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

2 participants