Fork me on GitHub
#pedestal
<
2017-03-26
>
deg14:03:30

@ddeaguiar - in you gist a few days back (https://gist.github.com/ddeaguiar/d93a81282b60a261a2afb53262a3aeeb), what exactly is returned by pull ?e [*]? In my case - where a single result is found, I'm seeing [[[{"db/id":17592186045428,"receipts.user/name":"David Goldfarb","...}]]], but [[]] when there are no matches. It seems that the first case has an extra vector wrapped around it.

deg14:03:00

Another Vase question (unrelated to previous): It looks like, (judging by the example code, e.g. https://github.com/cognitect-labs/vase/blob/master/samples/petstore-full/resources/petstore-full-order.edn): :get requests take unadorned keywords as parameters to a #vase/query literal. But :post queries need fully namespaced keywords to pass to a #vase/transact. Is this asymmetry really there, or am I misunderstanding something. If so, why?

mtnygard15:03:55

@deg There's a subtle reason for the difference, and it's reflected in the way those two different literals are formed. A query often uses parameters that come from the browser in a query string (e.g., for a GET, PUT, or DELETE.) These arrive from Pedestal as either :path-params or :query-params. Their names are URL-encoded by the browser and would be part of the request string in most cases. E.g., GET on /users/mtnygard would have a path that bind the last fragment to :id. None of these have anything to do with the Datomic schema or it's attribute names.

mtnygard15:03:07

OTOH, transactions are directly dealing with form data. The :properties key on the transact literal is a whitelist of parameters from the form body that directly name Datomic attributes on the given entity. So they may be namespaced if you define your Datomic schema that way.

deg15:03:48

@mtnygard - That makes sense; or at least each half makes sense in isolation. But, it feels like the is forcing the creation of asymmetric APIs. I don't want to speculate about ways to fix it; I have some ideas, but anything I say will be naive and/or wrong at this stage, but it just has a funny smell to me. Are there any public samples of clients that interact with Vase servers? I'd feel more comfortable expressing an opinion once I see how this is used by folks who know what they are doing.