This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-12
Channels
- # announcements (2)
- # aws (1)
- # beginners (63)
- # cider (2)
- # clj-kondo (1)
- # cljdoc (15)
- # clojure (114)
- # clojure-nl (1)
- # clojure-spec (15)
- # clojure-uk (10)
- # clojurescript (5)
- # clojutre (1)
- # community-development (6)
- # cursive (18)
- # data-science (1)
- # datascript (16)
- # datomic (2)
- # emacs (2)
- # events (3)
- # figwheel-main (2)
- # graphql (3)
- # jobs (2)
- # off-topic (23)
- # reitit (3)
- # shadow-cljs (27)
- # spacemacs (5)
- # sql (27)
- # unrepl (1)
i have a route in which path parameters are coercing to UUIDs just fine, but the optional query parameters aren't. any ideas? 🙂
(defonce router (rf/router routes {:data {:coercion reitit.coercion.spec/coercion}}))
(def routes
; apply Spec coercion to all routes
["/" {:coercion reitit.coercion.spec/coercion}
["clothes" {:name :route/clothes}
["/{catalogue/uuid}" {:name :route/catalogue
:parameters {
; works like a charm
:path {:catalogue/uuid uuid?}
; this definitely checks that :p is a uuid but i get a string
; in the controller
:query {(ds/opt :p) uuid?}}
:controllers [{:identity identity
:start (fn [match]
; but it comes out as a string in the match
(js/console.log "is UUID" (-> match :path-params :catalogue/uuid type))
(js/console.log "is String" (-> match :query-params :p type)))}]}]]])