Fork me on GitHub
#pedestal
<
2017-04-07
>
mtnygard00:04:16

@ddeaguiar Looking for a sanity check. #vase/transact properties do not allow for defaults. However, Datomic doesn’t allow nils in transactions. That means we can’t have optional properties to a transact. Seems like an oversight to me. I want to add the same defaulting syntax to transact’s properties that query’s params has. Does anything there sound like it violates the principle of least surprise?

ddeaguiar13:04:02

@U06BLR1C6, I’m biased by my knowledge of Datomic, so I think it does violate the principle of least surprise. It would make Query and Transact more symmetrical, though. However, I don’t think that’s a good enough reason to make it a supported feature. It’s also something that can be easily implemented on the client side. I’d hold off unless there’s a demand for it.

ddeaguiar13:04:01

If anything, nils should be filtered out. I don’t know if this is a property of #vase/transact or not

mtnygard15:04:06

Filtering nils is a good idea. I’ll do that now because it’s the smaller change to behavior.

imetallica01:04:10

Hi everyone, I'm not being able to make Pedestal reload code on changes from the default project template. I've run lein run-dev. Is there something missing? I'm new to Clojure and still trying to get my feet wet. 🙂

jimmy07:04:06

hi guys, does pedestal test response-for supports passing params like transit-params or only headers and body ?

imetallica11:04:15

@nxqd cool, I'll have a read.

ddeaguiar13:04:14

@imetallica you just need to reload the service ns

deg15:04:25

@ddeaguiar I'm seeing a much more nested structure than that. With route:

"/users" {:get <#C49BSM9B3|vase>/query {:name :receipts-server.v1/users-get
                                            :query [:find (pull ?e [*])
                                                    :where [?e :user/name]]}}
and query GET I get back
[[[["^ ","~:db/id",17592186045426,"~:user/name","David Goldfarb","~:user/abbrev","D","~:user/email",""]],[["^ ","^0",17592186045428,"^1","Shoshana Goldfarb","...

ddeaguiar15:04:46

hrm, so you can get rid of some of the nesting by doing this :find [(pull ?e [*]) ...]

ddeaguiar15:04:04

That’s from memory so I think it’s correct 🙂

deg15:04:22

Interesting. What does that mean exactly?

ddeaguiar15:04:03

It’s an indication that you expect a collection of results back for the query expression

ddeaguiar15:04:36

I would have thought you’d get maps back in that nested structure you pasted above

ddeaguiar15:04:11

I’m curious. Let me run a quick test

deg15:04:42

With that change, I now get this: [[["^ ","~:db/id",17592186045426,"~:user/name","Degel","~:user/abbrev","Degel"]]]. It looks like it only retrieved one user.

deg15:04:37

I'm going to disappear in a few minutes, and I'll be only very intermittently here for the next two weeks. Apologies if I go silent; these slack channels hit the history horizon so fast that I may not even know you were talking to me.

jimmy15:04:27

@ddeaguiar yeah I have read the docs. So we still need a http client lib like clj-http to do integration test? it would be great if response-for supports transit-params and such 😄

ddeaguiar15:04:58

@nxqd, you should be able to generate a transit payload as the :body

jimmy15:04:52

@ddeaguiar hmm, yeah, forgot it. Thanks !

ddeaguiar15:04:18

Note how a level of nesting was removed by using ...

deg15:04:15

Got it. I hadn't realized above that the ... was literal.

deg15:04:11

This does reduce a level. But, still a nested vector rather than the map shown int the Datomic docs.

kenny22:04:59

Is there a way to gracefully shut down a SSE stream? If I have a client that connects and then disconnects sometime later, I always receive this error message:

WARN io.pedestal.http.impl.servlet-interceptor - {:msg "The pipe closed while async writing to the client; Client most likely disconnected.", :line 111, :src-chan #object[clojure.core.async.impl.channels.ManyToManyChannel 0x23572315 "clojure.core.async.impl.channels.ManyToManyChannel@23572315"]}