This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-20
Channels
- # babashka (56)
- # beginners (151)
- # calva (3)
- # cider (31)
- # clj-kondo (17)
- # cljs-dev (5)
- # clojure (26)
- # clojure-australia (21)
- # clojure-dev (7)
- # clojure-europe (23)
- # clojure-nl (5)
- # clojure-spec (54)
- # clojure-uk (11)
- # clojuredesign-podcast (8)
- # clojurescript (77)
- # community-development (10)
- # core-typed (1)
- # cursive (3)
- # datomic (7)
- # docker (67)
- # emacs (10)
- # expound (6)
- # figwheel-main (3)
- # graalvm (67)
- # helix (10)
- # java (13)
- # jobs (6)
- # kaocha (4)
- # leiningen (15)
- # malli (2)
- # meander (31)
- # off-topic (40)
- # pedestal (9)
- # rdf (7)
- # reagent (5)
- # reitit (9)
- # remote-jobs (5)
- # shadow-cljs (94)
- # sql (7)
- # testing (12)
- # tools-deps (75)
- # vim (13)
Hi! I wonder why I am getting namespaced parameters when using spec for coercion in reitit. Any ideas on how to use unqualified here?
(s/def ::entity any?)
(s/def ::tx-data (s/coll-of ::entity))
(s/def ::tx-meta (s/coll-of ::entity))
(s/def ::transactions (s/keys :req-un [::tx-data] :opt-un [::tx-meta]))
well. the entity bit is more a placeholder here. That needs to be further specced. but reitit does not allow non-namespaced keywords.
Assert failed: k must be namespaced keyword or resolvable symbol
(c/and (ident? k) (namespace k))
Swagger generation depends on your coercion, and in the case of spec
it will coerce your parameters into swagger docs https://github.com/metosin/reitit/blob/master/modules/reitit-spec/src/reitit/coercion/spec.cljc#L97, and will use spec-tools
to do it 🙂
So try wrapping your spec definition with an https://github.com/metosin/spec-tools/blob/master/docs/05_swagger.md#annotated-specs
So you'd declare your body params with something like:
["/transact" {:post {:parameters {:body (st/spec {:spec ::transactions
:name "Transactions"})}}}]
Maybe that will work? 🙂