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

json4s marshaller also provided for () it seems #52

Closed
ktoso opened this issue Feb 15, 2016 · 2 comments

Comments

@ktoso
Copy link

@ktoso ktoso commented Feb 15, 2016

As found in http://danielasfregola.com/2016/02/07/how-to-build-a-rest-api-with-akka-http/comment-page-1/#comment-236

The confusion:

Unfortunately, Akka Http resolves complete(Future(())) with an http response with code 200 and empty body — same as complete(Future(None))! Please, put a comment below if you know the rationale behind this design choice.

The reason: http://danielasfregola.com/2016/02/07/how-to-build-a-rest-api-with-akka-http/comment-page-1/#comment-236

It picks up de.heikoseeberger.akkahttpjson4s.Json4sSupport#json4sMarshaller for Unit as well, causing unexpected outcome. I see it may be tough to change the types around given how this works here but worth pointing out or thinking about perhaps.

@hseeberger

This comment has been minimized.

Copy link
Owner

@hseeberger hseeberger commented Feb 15, 2016

See #49. This is due to Json4s being a crappy library.

@jrudolph

This comment has been minimized.

Copy link

@jrudolph jrudolph commented Feb 16, 2016

We've stumbled over these kind of things in the past as well (e.g. in spray/spray#990 (comment)). One conservative "solution" would be not to provide any reflection-based implicit marshallers automatically at all. Instead, the developer would need to create a little library of domain type marshallers as suggested by @sirthias in the above thread.

I.e. json4sMarshaller is either made not implicit or at least it is not imported and the user then creates tightly scoped implicits with

implicit def fooFormat = json4sMarshalling[Foo]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.