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[List[A]] #89

Open
mandoolala opened this issue May 17, 2021 · 0 comments

Comments

@mandoolala
Copy link

mandoolala commented May 17, 2021

This is my code:

case class ClassA(a:String, b:String …) // >22 case classes

object ClassA {
   implicit val classAJsonFormat = Jsonx.formatCaseClassUseDefaults[ClassA]
}

case class ClassB(classAlist: List[ClassA] = List(), a:String, b: String …) // >22 case classes

object ClassB {
   implicit val classBJsonFormat = Jsonx.formatCaseClassUseDefaults[ClassB]
}

I get compilation error with the message:

could not find implicit value for parameter helper: play.api.libs.json.Reads[List[A]]
TRIGGERED BY: could not find implicit value for parameter helper: ai.x.play.json.OptionValidationDispatcher[List[A]]
TO SOLVE THIS
1. Make sure there is a Reads[List[A]] or Format[List[A]] 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 lazy val jsonFormat = Jsonx.formatCaseClassUseDefaults[B]

I have read the related issues (ex. #58) and tried to use formatSealed CompositeClassJsonFormat etc., but nothing seems to work. T^T

scala 2.12.10, play-json 2.8.1, play-json-extensions 0.10.0

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