I have a Scala case class
case class NumericParam(minValue: Option[Int] = None,
maxValue: Option[Int] = None,
decimalPlaces: Option[Int] = None,
signed: Option[Boolean] = None,
hintText: Option[String] = None)
and its companion object, where I defined an implicit writes method
object NumericParam {
implicit val writes = new Writes[NumericParam] {
override def writes(value: NumericParam): JsValue = {
Json.obj(
"dataType" -> "Numeric",
"minValue" -> value.maxValue,
"maxValue" -> value.maxValue,
"decimalPlaces" -> value.decimalPlaces,
"signed" -> value.signed,
"hintText" -> value.hintText
)
}
}
}
I am adding the field dataType. Is there any way to use the macro-derived Writes value (from Json.writes[NumericParam]) and just add the additional dataType field?