-
Notifications
You must be signed in to change notification settings - Fork 29
added AkkaHttpJsonapiSupport - Java 1.8 #39
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
Conversation
I think the build fails because akka requires Java 1.8 |
akka version that supports java 1.7 is It's up to you to make a decision how to handle that, by my project uses Java 1.8 and akka 2.4.4 The PR I did is a ported version of the code we have in use internally |
In order to support akka-http (latest version) I had to drop support for Java 7 and move to Java 8, and also drop support for Scala 2.10 |
Current coverage is 92.96%@@ master #39 diff @@
==========================================
Files 9 10 +1
Lines 280 284 +4
Methods 280 284 +4
Messages 0 0
Branches 0 0
==========================================
Hits 264 264
- Misses 16 20 +4
Partials 0 0
|
import akka.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller } | ||
|
||
trait AkkaHttpJsonapiSupport extends SprayJsonJsonapiFormat with DefaultJsonProtocol { | ||
implicit def akkaHttpJsonJsonapiMarshaller(implicit printer: JsonPrinter = PrettyPrinter): ToEntityMarshaller[RootObject] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using following marshaller:
implicit def jsonApiMarshaller[T: JsonapiRootObjectWriter]: ToEntityMarshaller[T] =
Marshaller.withFixedContentType(jsonApiContentType) { obj =>
HttpEntity(`application/vnd.api+json`, obj.rootObject.toJson.compactPrint)
}
So I think it is better to use non-string marshaller (if possible). This is also generic one based on Writer.
@zmeda I addressed your points in my latest commit, it's in fact much better now |
Adds Akka Http Support - fixes #29