Fork me on GitHub
#beginners
<
2018-07-17
>
uwo02:07:47

@hiredman thanks again. I see what you mean. I’ve changed it so that each step thru the sequence functions at the beginning returns a fully realized section that is placed on the chan.

dangercoder09:07:17

Guys when you are (manually)testing your graphql api-endpoints, are you using curl or something like Insomnia?

3Jane14:07:14

regression testing is extremely useful for testing branch vs master

Mario C.16:07:11

Question: I am using a library called Nippy from taoensso. I am serializing this object but I am also using this library called Cheshire that encodes our map into JSON. The problem I run into is that when cheshire tries to encode a nested map that has been serialized, it breaks. It complains Cannot JSON encode object of class: class [B: [B@3384e3c0

Mario C.16:07:20

Does anyone have any experience with this? Or can point me to the right direction

hiredman16:07:25

what do you expect to happen?

hiredman16:07:40

there is no byte or byte array type in json

hiredman17:07:08

[B is the type of a byte array on the jvm

Mario C.17:07:11

I mean the problem makes sense so its not that I expected anything I just didn't think this far ahead until now that I am running into the issue

noisesmith17:07:23

for a serialization library that is easy to extend to specific types and allows a json formatted target, there's cognitect/transit btw

noisesmith17:07:53

it's easy to add custom serializers / deserializer for any type you like with transit

Mario C.17:07:21

I believe cheshire has custom encoding

Mario C.17:07:39

just not sure how to go about it

hiredman17:07:00

it does, which is kind of what I was getting at with "what did you expect?" because depending on what you want to happen, you might be able to make it do that

hiredman17:07:02

maybe the most common thing to do with bytes in json is to encode it as a base64 encoded string

hiredman17:07:35

base85 is cool, but much less standard

hiredman17:07:55

in general binary data in json is just gross

Mario C.17:07:48

Thanks because I had no idea what or how to encode that byte array into a JSON suitable format

hiredman17:07:53

cheshire also supports a binary format called smile which is similar to json, and may support encoding bytes

hiredman17:07:10

(I've never actually seen anyone use smile though)

noisesmith17:07:37

sadly with cheshire the encoding options are a global config - but isn't nippy already a serialization format? what's the usecase for serializing your serialized data again?

Mario C.17:07:23

Thats a very good question 😅

noisesmith17:07:05

if what you need is an efficient round-trip format that is also readable as json as an intermediate representation, transit does that, but first you might want to make sure that's really your goal

noisesmith17:07:35

and with a global config you can make cheshire accept any class you like as well

Mario C.17:07:32

Wont be using nippy freeze after all. At least for the time being

Radek20:07:42

getting stuck with Java interop I’m trying proxy and reify interface com.google.pubsub.v1.MessageReciver

Radek20:07:54

proxy works but reify fails

Radek20:07:28

any ideas what I’m doing wrong ?

noisesmith20:07:35

there's no this arg with reify is there? that's not the issue

noisesmith20:07:50

is reciveMessage something it gets from a concrete class it inherits from?

noisesmith20:07:06

because proxy can handle that, reify can't

Radek20:07:05

sorry my java voodoo is not so strong

Radek20:07:23

here is doc for that interface

noisesmith20:07:03

to be clear, you specify reciveMessage above, and the class defines receiveMessage - disregard if that's trivial of course

noisesmith20:07:39

(what you showed above can't be the real code as neither of those would have worked)

Radek20:07:50

yeah proxy didn’t work as well when I was trying to use it 😕

hiredman20:07:51

(reify
  com.google.cloud.pubsub.v1.MessageReceiver
  (^void receiveMessage [_
                   ^com.google.pubsub.v1.PubsubMessage _
                   ^com.google.cloud.pubsub.v1.AckReplyConsumer _]
    ))

hiredman20:07:14

the ^void is likely only required because of the other type hints

Radek20:07:29

great that works !