You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Annotation based configuration is super useful, but it might be hard to use in cases when one's datatypes are part of e.g. public API and are shared among few apps. Bringing circe, cats and friends into scope is almost impossible.
Of course one can use derived methods explicitly, but it's not as convenient as using circe's deriveConfiguredCodec and similar. Snippet included to issue doesn't use any configuration options but each one of them will require additional codes which is not easy to write as there are almost no comments in sources.
Reproduction uses scala-cli and locally published version of library.
//>usingscala"3.2.0"//>usinglib"com.evolution::derivation-circe:0.1-fd8fba2a1f9529f0adc55912129fe9a6974918fc-SNAPSHOT"importevo.derivation.*importevo.derivation.circe.*importevo.derivation.config.Configimportio.circe.CodecfinalcaseclassMyDataType(foo: String, bar: Int)
objectMyDataType:implicitvalactionCodec:Codec[MyDataType] =EvoCodec.derived[MyDataType](usingConfig.derived[MyDataType])
The text was updated successfully, but these errors were encountered:
Yeah, the lib is definitely supposed to be used when you need to write some of your derivation by hand.
I think, the the desired usage would be something like
objectMyDataType:givenConfig[MyDataType] =Config.derived.copy(...) // some user customizations heregivenCodec[MyDataType] =EvoCodec.derived
If that suits you we can think of a better set of methods for config to make configuration easier.
Moreover, the derivation core is supposed to be a lightweight library so that one can use it in the "Public API" part. It doesn't mention any circe, etc. parts. So I still think that one can use annotations even in public API with no commitment to serialization\schema library
Annotation based configuration is super useful, but it might be hard to use in cases when one's datatypes are part of e.g. public API and are shared among few apps. Bringing circe, cats and friends into scope is almost impossible.
Of course one can use
derived
methods explicitly, but it's not as convenient as using circe'sderiveConfiguredCodec
and similar. Snippet included to issue doesn't use any configuration options but each one of them will require additional codes which is not easy to write as there are almost no comments in sources.Reproduction uses scala-cli and locally published version of library.
The text was updated successfully, but these errors were encountered: