This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-20
Channels
- # beginners (43)
- # boot (44)
- # chestnut (17)
- # cider (78)
- # cljs-dev (24)
- # cljsrn (16)
- # clojure (84)
- # clojure-dusseldorf (1)
- # clojure-italy (21)
- # clojure-losangeles (2)
- # clojure-russia (140)
- # clojure-sg (2)
- # clojure-spec (8)
- # clojure-uk (16)
- # clojurescript (23)
- # cursive (7)
- # datascript (1)
- # datomic (18)
- # docker (20)
- # ethereum (1)
- # fulcro (16)
- # garden (4)
- # graphql (27)
- # hoplon (9)
- # jobs (4)
- # luminus (34)
- # off-topic (6)
- # om (4)
- # onyx (35)
- # pedestal (3)
- # re-frame (24)
- # ring-swagger (15)
- # rum (6)
- # shadow-cljs (22)
- # spacemacs (8)
- # specter (22)
- # yada (7)
Hi, I'm trying to use [compojure-api "2.0.0-alpha7"]
with :coercion :spec
, but I can't figure out the syntax.
1. Can it be applied to an api
? If so, does it go inside the map of options (first argument)? (api {:coercion :spec} (context ...))
2. Can it be applied to a context
? If so, does it just float around loose inside the block? (context "/blah" [] :coercion :spec (GET "/" (ok "hi")))
3. Can it be applied to an endpoint (like a GET
)? If so, does it also float around loose in there? (GET "/" [] :coercion :spec (ok "hi"))
Essentially I want to have spec coercion on everything always, but I currently can't start a repl at all, it always gives me cant find named-coercion for :spec {:name :spec}
. I've been looking at these docs, but I'm doing something wrong:
https://github.com/metosin/compojure-api/wiki/Coercion
https://github.com/metosin/compojure-api/blob/master/examples/coercion/src/example/spec.clj
hi @conan it can be applied to all levels. But to enable the spec-coercion, one needs to add manually some dependencies, to org.clojure/clojure
& metosin/spec-tools
.
It seems to be documented at https://github.com/metosin/compojure-api/wiki/Coercion#spec-coercion
there are few issues with Spec currently, see issues. The apidocs for recursive specs might take some time, others should be fixed soon.
I am trying to set a non strict schema validation, where the extra keys are allowed. I came across https://github.com/metosin/compojure-api/issues/29 , but I could not find a proper solution yet
adding s/keyword s/Any to all the schemas seems excesive
does anyone have a solution for this?