Skip to content

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

Closed
wants to merge 4 commits into from

Conversation

wlk
Copy link
Contributor

@wlk wlk commented May 6, 2016

Adds Akka Http Support - fixes #29

@wlk
Copy link
Contributor Author

wlk commented May 6, 2016

I think the build fails because akka requires Java 1.8

@wlk
Copy link
Contributor Author

wlk commented May 6, 2016

akka version that supports java 1.7 is 2.3.15

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

@wlk wlk changed the title added AkkaHttpJsonapiSupport added AkkaHttpJsonapiSupport - Java 1.8 May 6, 2016
@wlk wlk force-pushed the add-akkahttp-support branch from 0057927 to 3994350 Compare May 12, 2016 17:47
@wlk
Copy link
Contributor Author

wlk commented May 12, 2016

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

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.3%) to 92.606% when pulling 48ba510 on wlk:add-akkahttp-support into d2753bc on zalando:master.

@codecov-io
Copy link

codecov-io commented May 12, 2016

Current coverage is 92.96%

Merging #39 into master will decrease coverage by 1.33%

@@             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          

Powered by Codecov. Last updated by e61dd2f...48ba510

import akka.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller }

trait AkkaHttpJsonapiSupport extends SprayJsonJsonapiFormat with DefaultJsonProtocol {
implicit def akkaHttpJsonJsonapiMarshaller(implicit printer: JsonPrinter = PrettyPrinter): ToEntityMarshaller[RootObject] = {
Copy link
Contributor

@zmeda zmeda May 23, 2016

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.

@wlk
Copy link
Contributor Author

wlk commented May 26, 2016

@zmeda I addressed your points in my latest commit, it's in fact much better now

@wlk wlk force-pushed the add-akkahttp-support branch from b86ff95 to 2c01da9 Compare May 26, 2016 14:55
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 93.262% when pulling 2c01da9 on wlk:add-akkahttp-support into e61dd2f on zalando:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 93.262% when pulling 2c01da9 on wlk:add-akkahttp-support into e61dd2f on zalando:master.

@zmeda zmeda closed this Jul 6, 2016
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 this pull request may close these issues.

Add support for Akka HTTP (un)marshalling
4 participants