-
-
Notifications
You must be signed in to change notification settings - Fork 106
Sealed trait member with own codec #463
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
Comments
Hi, Andrii! Thanks for trying and raising a question. As for me, derivation of codecs works quite logically - if you want to store a product type (not a sum type or an enum) then the discriminator (or a type tag) is redundant. The problem here that implicit values for Below is an example of how derivation and declaration of implicit values can be isolated to meet your expectations:
|
So in case I need |
Hi,
in case we encode by trait
writeToString[BatchSource]
expected:
{source":"Package","id":"17ebf4294-59ca-45a9-a6b7-373c2aa890fa","tag_id":"ASDZXC123123"}
actual:
{"id":"17ebf4294-59ca-45a9-a6b7-373c2aa890fa","tag_id":"ASDZXC123123"}
seem trait codec
codecBatchSource
just usingcodecPackage
without discriminator field.as you can see I explicitly tried
.withDiscriminatorFieldName(Some("source"))
incodecPackage
The text was updated successfully, but these errors were encountered: