twitter / finatra

Fast, testable, Scala services built on TwitterServer and Finagle
https://twitter.github.io/finatra/
Apache License 2.0
2.27k stars 408 forks source link

Port option long + other jackson niceties to a jackson scala module #409

Closed devshorts closed 7 years ago

devshorts commented 7 years ago

Finatra has a lot of really nice stuff to make serializing scala types easier with jackson. Specifically Option[Long] handling. However, this is locked away inside of Finatra, and not shareable to any other scala users without pulling Finatra in. It would be very nice to have a complementing jackson module that ported this code over so that the scala community can leverage it outside of Finatra.

AlexITC commented 7 years ago

As far as I know, you can use finatra-jackson without importing finatra, the module is supposed to be independent, look at the first feature from the project jackson:

Usable outside of Finatra

devshorts commented 7 years ago

@AlexITC I see that its an independent module, but the dependencies it brings in are pretty heavy weight. So while technically it doesn't pull in finatra it certainly pulls in all of finagle/twitter.

For example finatra-jackson pulls in

finatra-utils which pulls in finagle-http and inject-server which pulls in all of finagle core which pulls in netty.

That's a lot for a json serializer, and is rife for issues with dependency mismatches etc.

Is it possible to split some of that out so that just the json parsing is in a module that can be used without transitively pulling in finagle/netty?

kevinoliver commented 7 years ago

My guess is that it could be split in two modules, one with minimal dependencies and the other with the heavier dependencies. But... I don't know this code too well, so take my guess with heaps of salt.

I'm fine with it if you are interested in taking a crack.

Dunno if @cacoco or anyone else has feelings on it one way or the other.

On Wed, Apr 26, 2017 at 1:52 PM, Anton Kropp notifications@github.com wrote:

@AlexITC https://github.com/AlexITC I see that its an independent module, but the dependencies it brings in are pretty heavy weight. For example finatra-jackson https://mvnrepository.com/artifact/com.twitter.finatra/finatra-jackson_2.11/2.1.1 pulls in

finatra-utils which pulls in finagle-http and inject-server which pulls in all of finagle core which pulls in netty.

That's a lot for a json serializer, and is rife for issues with dependency mismatches etc.

Is it possible to split some of that out so that just the json parsing is in a module that can be used without transitively pulling in finagle/nett

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/twitter/finatra/issues/409#issuecomment-297537631, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVMXRNXbcsPwTRblVUSEvwr8_-s0U6xks5rz66FgaJpZM4NJW1D .

-- Kevin Oliver | Twitter, Inc | follow me: @kevino http://twitter.com/kevino

cacoco commented 7 years ago

@devshorts finatra/jackson only depends on the finatra/inject/inject-core, finatra/inject/inject-utils, and the finatra/inject/inject-slf4j module (more information about these modules here). However because of the custom request object case class integration it also pulls in finagle-http (only).

Thus the only other Twitter dependencies you should get with finatra/jackson is:

There is no dependency on finatra/inject/inject-server (or should not be unless the sbt definition is incorrect).

Finatra is deeply tied to Finagle. And Finagle is deeply tied to Netty. While there may be a nice way to split out Finatra's pure JSON functionality it is not the focus of Finatra and thus has not been given any priority and quite honestly will probably not be any time soon.