This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-21
Channels
- # adventofcode (47)
- # aleph (18)
- # announcements (20)
- # babashka (81)
- # beginners (23)
- # biff (6)
- # calva (5)
- # cider (50)
- # clojure (34)
- # clojure-europe (19)
- # clojure-norway (11)
- # clojure-spec (6)
- # clojure-uk (1)
- # clojurescript (2)
- # conjure (2)
- # cursive (14)
- # datomic (1)
- # humbleui (11)
- # hyperfiddle (3)
- # introduce-yourself (5)
- # joyride (1)
- # nbb (7)
- # off-topic (19)
- # podcasts-discuss (1)
- # reagent (3)
- # reitit (19)
- # releases (1)
- # ring-swagger (1)
- # shadow-cljs (29)
- # sql (6)
- # squint (56)
There was discussion last week about supporting LocalDates in malli, but is that the way to go if I don't actually have schemas, but would like to get reitit to not die when it tries to encode LocalDates into transit+json?
The other option I guess would be to follow https://github.com/metosin/muuntaja/issues/92#issuecomment-810524369 example, that was for Instants?
https://cljdoc.org/d/metosin/muuntaja/0.6.8/doc/configuration#setting-transit-writers-and-readers
Aha, https://github.com/Motiva-AI/pipeline-transit might do that for me OOB
It does have unncessary dependency on joda-time though and uses format/parse fns from time-literals lib
also it makes the handler maps private, which is really strange, as exposing those should be the main API
Good point, I was also thinking that the write-transit function is not really helpful here
I need to read more about transit protocol, but I'm guessing it's also writing it as custom types, that can only be read with the same library
https://github.com/metosin/metosin-common/blob/master/src/cljc/metosin/transit/dates.cljc (this uses joda-time) doesn't need much else, java-time toString
already outputs ISO formatted string and parse
might be enough to parse those
Yes, I also use custom tags ~always.
That's good enough for your own clients, but I was hoping for a solution that works without customizing the reader. But I haven't given enough thought about it to decide if that even makes sense, since the different time types are distinct for a good reason
Might be that I'm thinking about it too far, and shouldn't look further than our own frontend, and keeping the stable, public API JSON only
transit time tag only covers instants as milliseconds since epoch, if you try formatting anything other than instants in that tag, you will be losing information
No, even if you store LocalDate as ms since epoch in UTC, the information about original type will be lost and client will read it as instant
Especially in browsers that means that browser does stupid things with the instant