Fork me on GitHub
#ring-swagger
<
2017-09-20
>
conan15:09:44

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

ikitommi15:09:39

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.

conan15:09:00

oh, i don't have spec-tools

conan15:09:30

ah, right, that'll be it

conan15:09:34

thanks very much

ikitommi15:09:42

the docs are bit out of sync, will be better when 2.0.0 out

conan15:09:11

yeah it's a lot to ask for them to keep up with the code!

conan15:09:31

yes, that's got it, much obliged

ikitommi15:09:31

there are few issues with Spec currently, see issues. The apidocs for recursive specs might take some time, others should be fixed soon.

conan16:09:11

my use case is just coercions, apidocs can come later - sorry future me...

psalaberria00220:09:44

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

psalaberria00220:09:06

adding s/keyword s/Any to all the schemas seems excesive

psalaberria00220:09:28

does anyone have a solution for this?