These are chat archives for hseeberger/akka-http-json

24th
Aug 2016
Guillermo Lammers Corral
@glammers1
Aug 24 2016 11:33

Hi!

The new feature of Akka 2.4.9 uses FromByteStringUnmarshaller[T] as implicit. Are you thinking to include it?

Heiko Seeberger
@hseeberger
Aug 24 2016 11:49
@glammers1, please elaborate.
Guillermo Lammers Corral
@glammers1
Aug 24 2016 13:07

Of course, sorry.

I'm talking about the new feature related to marshalling of Akka Streams into/from Http requests and responses. Let's see some code:

path("bar") {
    entity(asSourceOf[Foo]) { foos =>

The method asSourceOf needs a type FromByteStringUnmarshaller[T] = Unmarshaller[ByteString, T] as implicit. I usually use akka-http-json to unmarshall HttpEntity, i.e, using type FromEntityUnmarshaller[T] = Unmarshaller[HttpEntity, T].

My question is: what do you think is the best way to use a Unmarshaller[ByteString, T]? Do you think is it possible to include in akka-http-json?

Heiko Seeberger
@hseeberger
Aug 24 2016 13:17
I haven't yet looked at this feature in depth. I wonder how it should be possible to unmarshall an arbitrary byte string into an instance of Foo: What if the byte string doesn't contain all the data (because the rest is contained in the next chunk)? What if the byte string contains too many Foos?
If Akka HTTP takes care of providing properly chunked byte strings, then it should be easy to implement this.
Do you want to give it a try?
Denis Mikhaylov
@notxcain
Aug 24 2016 15:43
As far as I understand it is a matter of contract if these chunks represent single parseable unit