Skip to content
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] Recursive type derivation doesn't pick up default codecs #87

Closed
vpavkin opened this issue Apr 10, 2018 · 2 comments · Fixed by #91
Closed

[Circe] Recursive type derivation doesn't pick up default codecs #87

vpavkin opened this issue Apr 10, 2018 · 2 comments · Fixed by #91

Comments

@vpavkin
Copy link
Contributor

vpavkin commented Apr 10, 2018

Reproduction: https://github.com/vpavkin/magnolia/blob/e278256e713ddf3b1aa3365898e930eff168274b/tests/src/main/scala/CirceRecursiveTypeTest.scala

For types of this shape:

case class Recursive(field: Int, recursion: List[Recursive])

Problem here is that we expect the same behaviour as shapeless Lazy provides - the derived codec itself would be visible and used to construct the codec for List using circe std one.

Magnolia doesn't see it and derives coproduct codec for List instead, which doesn't look nice for json API:

  {
   "::":{
      "head":{
         "field":2,
         "recursion":{
            "Nil":"Nil"
         }
      },
      "tl$access$1":{
         "Nil":"Nil"
      }
   }
}
@joroKr21
Copy link
Contributor

Turning on -Xlog-implicits shows (disregarding noise) an access error for magnolia.Deferred. It looks like it should be made public for the sole purpose of typechecking.

@vpavkin
Copy link
Contributor Author

vpavkin commented Jun 6, 2018

Actually I found another small problem, related to this particular testcase. Will file another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants