This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-22
Channels
- # beginners (55)
- # cider (22)
- # cljs-dev (123)
- # cljsrn (75)
- # clojars (1)
- # clojure (92)
- # clojure-europe (2)
- # clojure-italy (16)
- # clojure-nl (6)
- # clojure-spec (17)
- # clojure-uk (77)
- # clojured (2)
- # clojurescript (39)
- # core-async (8)
- # cursive (4)
- # data-science (1)
- # datomic (22)
- # duct (4)
- # editors (21)
- # emacs (10)
- # events (4)
- # fulcro (116)
- # graphql (8)
- # immutant (3)
- # jackdaw (1)
- # juxt (3)
- # kaocha (4)
- # luminus (1)
- # mount (1)
- # nrepl (32)
- # off-topic (34)
- # other-languages (5)
- # pedestal (32)
- # reagent (1)
- # ring (6)
- # ring-swagger (7)
- # shadow-cljs (5)
- # spacemacs (3)
- # specter (1)
- # sql (1)
- # vim (21)
@salo.kristian check this out:
(clojure.spec.alpha/valid? ::instruments (repeat 10 "test")) ;;true
(GET "/" []
:coercion :spec
:summary "Get all user's instruments"
:return ::instruments
(ok (repeat 10 "test"))) ;;works
(GET "/" []
:coercion :spec
:summary "Get all user's instruments"
:return ::instruments
(ok (repeat 10 "test"))) ;;works
(GET "/:id" [id]
:coercion :spec
:summary "Get all user's instruments"
:return ::instruments
(ok (repeat 10 id))) ;;works with get /3
I also tried it without any destructuring, and the same problem persists. Something else in my api definition is probably causing it. I'll need to debug it further
Found the problem. I had this in my root routes file:
(api/context "/instruments" []
:auth-rules buddy/authenticated?
:responses {401 {}
403 {}}
:tags ["Instrument"]
instrument/routes)
The syntax in the :responses
route param is invalid, and caused this problem. What is interesting is that setting :coercion :spec
anywhere in the route definition caused the error to be thrown. With the default Schema validation everything was working fine. I now included the required keys in the :responses
maps and everything is working fine. Thanks for the help anyways!@salo.kristian looks like a bug. Could you write an issue out of that? Thanks.