Fork me on GitHub
#yada
<
2016-03-16
>
nha10:03:39

Thanks ! I get this :

Possibly confusing dependencies found:
[lein-hiera "0.9.0"] -> [org.clojure/tools.namespace "0.2.4"]
 overrides
[com.jakemccrary/lein-test-refresh "0.10.0"] -> [org.clojure/tools.namespace "0.2.11" :exclusions [org.clojure/clojure]]

Consider using these exclusions:
[com.jakemccrary/lein-test-refresh "0.10.0" :exclusions [org.clojure/tools.namespace]]

Aborting due to :pedantic? :abort

malcolmsparks10:03:49

@nha - check your .lein/profiles.clj - comment out lein-hiera

malcolmsparks10:03:59

that will fix it

nha10:03:17

Oh I forgot about that - thanks a lot (I tend to use boot now)

nha10:03:38

(global state strikes again ^^)

malcolmsparks10:03:42

I believe you could put lein-hiera in a profile, that way you could still use it with a with-profile but prevent it getting in the way of your normal work

malcolmsparks10:03:53

I tend to use boot now too! simple_smile

nha10:03:10

boot-clj is great

malcolmsparks10:03:35

I will migrate yada's dev profile to boot at some point, but there's more critical priorities on my todo list right now

ordnungswidrig14:03:21

hey, @r0man, nice to have you around

r0man14:03:12

hey billy, looking into yada a bit ...

r0man17:03:12

Hello, I just noticed that lazy seqs returned from a handler don't participate in content negotiation. Is this intentional, or did I hit a bug?

malcolmsparks18:03:54

@r0man: can you expand a bit? I'm not sure I follow. Content negotiation happens before your response function is called. Or do you mean the result of something like (handler (range 1000)) doesn't participate in conneg?

malcolmsparks18:03:06

That would be because yada can't infer anything from a lazy sequence (how could it), instead you could do (handler (resource {:response (range 1000) :produces "application/edn"}))

malcolmsparks18:03:49

Mostly, the yada shorthands are fairly primitive and mostly used as tutorial pieces

malcolmsparks18:03:39

I might have misunderstood you, so sorry if I did

r0man18:03:44

@malcolmsparks: In my handler I fetch records from a db and they are returned in a lazy seq. When I call vec on the seq, content negotiation works. I just expected a lazy seq would be handled the same way as a vector.

malcolmsparks18:03:43

What happens when you add (extend-protocol yada.body.MessageBody clojure.lang.LazySeq (to-body [v representation] (yada.body/encode-message (yada.body/render-seq v representation) representation)))

malcolmsparks18:03:59

yes, looks like a bug to me - see yada.body.clj

r0man18:03:28

When I send an accept header of application/json and return (map identity [{:a 1}]) from the handler it is returned as EDN, and not JSON as I would have expected.

malcolmsparks18:03:01

Yes, it's not being encoded by the body

malcolmsparks18:03:33

Content negotiation is happening though (you should see application/json as the Content-Type in the response header)

malcolmsparks18:03:38

Try yada 1.1.2

malcolmsparks18:03:50

Does that fix it?

r0man18:03:49

@malcolmsparks: Yes, 1.1.2 works as expected. Thanks! simple_smile

malcolmsparks18:03:45

Cool. Thanks for the bug report!

r0man18:03:47

np. thanks for yada!