package a
final case class mySettings(multicache: myCacheSetting, defaultTtlHours: Duration)
final case class myCacheSetting(
weightedRoundrobin: InternalWRRMultiCacheSetting,
attempts: Int,
clusters: Seq[MyClusterSetting]
)
final case class MyClusterSetting(id: String, settings: InternalMyClientSettings)
final case class InternalMyClientSettings(
user: String,
environment: Option[InternalMyClientEnvironmentSettings]
)
final case class InternalMyClientEnvironmentSettings(
socketTimeout: Option[FiniteDuration],
connectTimeout: Option[FiniteDuration],
)
final case class InternalWRRMultiCacheSetting(maxWeight: Int, incrementWeight: Int, decrementWeight: Int)
This class needs to be converted into
package b
final case class mySettings(multicache: myCacheSetting, defaultTtlHours: Duration)
final case class myCacheSetting(
weightedRoundrobin: InternalWRRMultiCacheSetting,
attempts: Int,
clusters: Seq[MyClusterSetting]
)
final case class MyClusterSetting(id: String, settings: InternalMyClientSettings)
final case class InternalMyClientSettings(
user: String,
company: String,
environment: Option[InternalMyClientEnvironmentSettings]
)
final case class InternalMyClientEnvironmentSettings(
socketTimeout: Option[FiniteDuration],
connectTimeout: Option[FiniteDuration],
)
final case class InternalWRRMultiCacheSetting(maxWeight: Int, incrementWeight: Int, decrementWeight: Int)
as you can see both classes are almost similar except that the second class contains an additional field company. company needs to be filled with a constant.
A explaination on how you found the solution will be appreciated
I tried using into and transformInfo from scalaland:chimney but it didnt help. The missing field is causing a lot of issues while transforming