-
Notifications
You must be signed in to change notification settings - Fork 117
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
[Circe] Add a way to skip dispatch over intermediate abstract classes/traits #88
Comments
Thanks for the report and reproduction. I think it shouldn't be too difficult to fix. We currently use |
Would you mind checking whether this branch fixes the issue, @vpavkin? I haven't had a chance to test it... https://github.com/propensive/magnolia/tree/known-direct-and-indirect-subclasses |
@propensive thanks! Will test the branch asap, hopefully by the end of the day will have some results |
@propensive it helped! I rebased #86 onto #98 and now these two pass:
|
Great, that's progress! It's only a partial fix, so I've reopened after it auto-closed. |
Reproduction: https://github.com/vpavkin/magnolia/blob/e278256e713ddf3b1aa3365898e930eff168274b/tests/src/main/scala/IntermediateTraitsTest.scala
Shapeless generic skips intermediate traits/abstract classes and forms a coproduct of only leaf types.
This makes perfect sense for many scenarios, JSON included.
Magnolia, on the other hand, dispatches through all intermediate types.
For encoding it's not that bad, but for decoding it's a showstopper.
Given
Encoding an instance of
C1
asT
will produce this (which is not nice, but manageable probably):But problem is that to properly decode an instance of
C1
we have to scope it asC
, which is very unfriendly to JSON API users. And the more simple and intuitive form won't decode:The text was updated successfully, but these errors were encountered: