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

Bug in borer-derivation? deriveCodec fails to compile when using type alias #388

Closed
MarconZet opened this issue Apr 27, 2021 · 14 comments
Closed

Comments

@MarconZet
Copy link

type Foo = String
case class Bar(bar: Foo)
implicit val barCodec: Codec[Bar] = deriveCodec

fails build with:

[error] MyBorerAkkaSerializer.scala:54:39: value writeMyBorerAkkaSerializer.this.Foo is not a member of io.bullet.borer.Writer
[error]   implicit val barCodec: Codec[Bar] = deriveCodec

Expected behaviour: Build successful

I found a workaround with:

implicit val barCodec: Codec[Bar] = Codec(
  Encoder.from(Bar.unapply _),
  Decoder.from(Bar.apply _)
)

but that's far from an elegant solution.

@sirthias
Copy link
Owner

Ok, thank you for reporting.
I happen to have time right now to look at this and will do so right away...

@sirthias
Copy link
Owner

Thank you, @MarconZet, for reporting.
The fix is already in the master branch.
Would you like a quick patch release to unblock this issue on your side?

@PawelLipski
Copy link

We'd appreciate a patch release :)

@sirthias
Copy link
Owner

Ok, just pushed borer 1.7.1 to sonatype.
You can pull it from there or wait for the sync to maven central, which is probably going to take a few hours though...
Thanks again for reporting!

@PawelLipski
Copy link

Wow that's one of the fastest report-to-release cycles I've seen in OSS so far ❤️

@sirthias
Copy link
Owner

:)
It was just a lucky coincidence that the bug report hit a perfect break between things on my side.
I'm glad that borer works out for your setup!

@PawelLipski
Copy link

Actually, FYI, as you've probably noticed, we're working on ready-to-use serializer for Akka messages/event/states, since Jackson that's suggested by Akka docs is a joke (surprising runtime failures, no support for Scala objects/ADTs etc.) 😅

Are you aware of any work that has been already done in that direction? There's borer-akka-compat but AFAICS it doesn't provide a ready Serializer, just Codecs for ActorRefs etc.

@PawelLipski
Copy link

Also @sirthias ... would it be possible to retain support for Scala 2.12 in 1.7+? Since AFAICS 1.7.0 and 1.7.1 have only been published for 2.13 ://

@sirthias
Copy link
Owner

There's borer-akka-compat but AFAICS it doesn't provide a ready Serializer, just Codecs for ActorRefs etc.

Yes. The reason is that we haven't needed these things ourselves yet.
I'd be happy to review and merge any PRs if you want to submit any...

@PawelLipski
Copy link

Great! We're prototyping that as a separate project for convenience as for now, but it makes sense to integrate it back into main borer repo... opened VirtusLab/akka-serialization-helper#18 for that

@mushtaq
Copy link
Contributor

mushtaq commented May 9, 2021

@PawelLipski We are using borer for akka-serialization using the pattern mentioned here.

@PawelLipski
Copy link

@mushtaq actually! since you're using Borer for a bit longer than us... do you have any experiences with migrating Akka events when Borer is used as a serializer (or any other library, for that matter)?

@mushtaq
Copy link
Contributor

mushtaq commented May 11, 2021

Unfortunately, no. So far, we do not have to deal persisting these events.

I just came across transducers in latest version of borer. Will that help?

@PawelLipski
Copy link

Looks promising! Let us take a look 👁️

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

No branches or pull requests

4 participants