I need to create an updated instance from a case class instance (with any needed DecodeJson
s implicitly derived), given an incomplete json (some fields missing). Ho
You can generate those implicit val defs / pd
with macro annotation on Person
(in object Person
, for example, and do import Person._
to summon implicits). See this unfinished Simulacrum in scalameta (scala-reflect is fine too, but seems like scalameta can be enough here) for usage examples. Also you have to specify missing default value (42
) somewhere, for example, in case class constructor (age: Int = 42
, recognition can be done in macro too).