This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-30
Channels
- # bangalore-clj (1)
- # beginners (23)
- # boot (1)
- # cider (23)
- # cljsjs (2)
- # cljsrn (4)
- # clojure (251)
- # clojure-dusseldorf (2)
- # clojure-gamedev (23)
- # clojure-italy (5)
- # clojure-russia (53)
- # clojure-sanfrancisco (5)
- # clojure-spec (7)
- # clojure-uk (66)
- # clojurescript (169)
- # community-development (21)
- # core-async (10)
- # cursive (15)
- # data-science (1)
- # datomic (7)
- # docker (1)
- # emacs (24)
- # events (1)
- # funcool (6)
- # hoplon (24)
- # liberator (1)
- # luminus (6)
- # lumo (62)
- # mount (7)
- # off-topic (1)
- # om (12)
- # om-next (5)
- # onyx (14)
- # overtone (2)
- # pedestal (58)
- # powderkeg (27)
- # protorepl (1)
- # re-frame (1)
- # ring-swagger (16)
- # rum (51)
- # spacemacs (25)
- # uncomplicate (7)
- # unrepl (22)
- # untangled (7)
- # yada (109)
If I pass it as a string to the http query, Datomic sees it as a string and complains. (I'd hoped that :edn-coerce
might help, but seems not).
If tried passing it as an #inst
on the CLJS side, hoping that some magic wrapping would occur, but something (cljs-ajax I assume, though I can't yet see where) converts it to "{}"
before it leaves the client.
I can’t speak to the CLJS side of it. But edn-coerce should work if the param contains a string like “#inst{xxxx}”. The tag has to be in the string.
It has to be in a specific time format: https://github.com/edn-format/edn#inst-rfc-3339-format
Do I need quote chars inside the braces? (I just tried and failed both with and without; so looking for other issues in my code too)
{"payload":[{"receipts.purchase/vendor":"Bus","receipts.purchase/uid":"D-1002","receipts.purchase/date":"#inst{1985-04-12T23:20:50.52Z}","receipts.purchase/price":12.34,"receipts.purchase/comment":"Test bus ride","receipts.purchase/currency":"USD","receipts.purchase/category":"Travel"}]}
Error is clojure.lang.ExceptionInfo: Interceptor Exception: java.lang.IllegalArgumentException: :db.error/wrong-type-for-attribute Value #inst{1985-04-12T23:20:50.52Z} is not a valid :inst for attribute :receipts.purchase/date
I think the inst field should look like this:
”receipts.purchase/date”:”#inst\”1985-04-12T23:20:50.52Z\”"
@ddeaguiar I’m not sure where we stand with the transit body support. I need to talk with Paul after the conference
Ah yes, there’s an open PR for that https://github.com/cognitect-labs/vase/pull/62
Still failing. And I tried both \"
(sending a quote across the wire) and \\\"
(in case the other side needed it quoted too).
I don't want to keep wasting your time on this... can you point me to any doc?
Hmm, so what I'm sending now seems to be valid edn, but I don't know what :edn-coerce expects. So, I think this reduces down to "I need more docs. You need to focus on Clojure West. This is not a critical piece of my toy; I can store dates as strings for now. So, Iet's revisit later". (is there any value in my opening github issues about these minor doc lacks, or will that be too noisy?)
from what you’ve shown me, i’d expect it to work. so there may be a bug here. please open an issue, but don’t assume its a doc task.
if you feel like getting your hands dirty with something new, it would be a nice place to have a generative test. Something that would generate any data, encode it as json, pass it through an edn-coerced param, and compare the resulting value to the original. “Round trip” tests like that are a nice place to use generative tests.
FWIW, edn itself seems to be more forgiving: => (clojure.edn/read-string "#inst \"1985\"")
#inst "1985-01-01T00:00:00.000-00:00"
also that instant implies a level of resolution that is not real. Keep that in mind
I found the problem, but not sure how to solve it. Surface problem: I had mistakenly put the :edn-coerce in the wrong place. Real issue: I need it in a #vase/transact, but there is no :params binding there
Later: I see from the samples (omnext-todo and petstore-full) that this is solved with an interceptor that coerces the date string. Is this the long-term plan? It feels heavy.
Hi,
When I do (response-for service :get "/path?foo&bar=123")
I expect :query-params {:foo nil :bar "123"}
, but pedestal do :query-params {nil "foo" :bar "123}
It's Intentional/expected?
which is the same as
(response-for service :get /foo-bar-path?foo=bar
but I’m pretty sure it encodes things for you
but I highly recommend using the url-for
helper for creating paths for use with response-for