Fork me on GitHub
#ring-swagger
<
2017-03-21
>
leena09:03:39

But for some reason getting a weird error

leena09:03:43

(defroutes inc-route (GET "/inc" [x] :query-params [x :- s/Int] :return {:result s/Int} (ok {:result (inc x)})))

leena09:03:57

error CompilerException java.lang.RuntimeException: [] is missing a schema

leena09:03:59

Same if x is not in [] in the beginning

ikitommi10:03:06

That's weird. But you can use just def here. x doesn't need to be set in the brackets. If it still doesn't work, please write an issue. Haven't seen that with versions 1.0.0+

leena10:03:30

Actually it works, the complaint comes from repl 😕

leena10:03:51

Thought it doesn't work cause repl was complaining, but lein run does not complain

plins21:03:02

is it possible to define which headers are necessary for a specific route/context? im searching the docs but cant find anything somethinglike :headers {"authorization" s/str}

mtkp22:03:12

yep! check out this example: https://github.com/metosin/compojure-api/wiki/Swagger-integration#sample-documented-endpoint replacing :query-params with :header-params