This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-07
Channels
- # aleph (4)
- # announcements (9)
- # babashka (44)
- # beginners (6)
- # cider (8)
- # clj-kondo (5)
- # clojars (10)
- # clojure (10)
- # clojure-berlin (1)
- # clojure-dev (9)
- # clojure-europe (20)
- # clojure-gamedev (1)
- # clojure-miami (2)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (5)
- # clojurescript (12)
- # conjure (1)
- # cursive (19)
- # data-science (2)
- # datahike (10)
- # etaoin (5)
- # events (3)
- # fulcro (14)
- # gratitude (2)
- # honeysql (8)
- # humbleui (1)
- # hyperfiddle (60)
- # introduce-yourself (7)
- # jobs-discuss (27)
- # juxt (2)
- # kaocha (7)
- # lsp (23)
- # malli (9)
- # missionary (2)
- # off-topic (48)
- # pathom (24)
- # releases (1)
- # shadow-cljs (256)
- # sql (46)
- # xtdb (19)
Hello, today I was using Malli and I tried to validate a UUID using (malli.core/validate :uuid "caa71a26-5fe1-11ec-bf63-0242ac130002"). However, it returned false. The string is from an example on the Malli GitHub page (under the title "decoding schema in inferring") , and I've also tried a couple of other valid UUID strings and using uuid? instead of the keyword. Does anybody have an idea what the problem could be?
it's not a UUID, it's a string representation of a UUID.
Try (malli.core/validate :uuid #uuid "caa71a26-5fe1-11ec-bf63-0242ac130002")
it fails for the same reason that "1"
is not an integer, it's a string representation of an integer.
Right, the same happened to me with java dates types and I just forgot about that 😅 #uuid works great. Thanks for the help!
if I have [:map [:id :uuid] [:age :int]], Is it possible to insert the #uuid in the map schema ?
I would recommend playing around using this tool: https://malli.io/?value=%7B%3Aid%20%23uuid%20%2246286bb1-3734-402f-8d8f-36f816d63367%22%2C%20%3Aage%200%7D&schema=%5B%3Amap%20%5B%3Aid%20%20%3Auuid%5D%20%5B%3Aage%20%3Aint%5D%5D
You can see there that {:id #uuid "46286bb1-3734-402f-8d8f-36f816d63367", :age 0}
conforms to the map schema you gave