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]))
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? 🙂
Thanks @david.russell. That did actually work!
Try:
(s/def :entity any?)
(s/def ::tx-data (s/coll-of :entity))
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))