ring-swagger

ring-swagger & compojure-api
kasuko 2018-05-09T19:03:47.000168Z

Hey, I have a compojure-api app that has a lot of endpoints. Recently I have moved my token from the "Authorization" header to a "token" parameter on all request for unrelated reasons. However, now compojure-api is throwing Request validation failed exceptions on all my routes because token is a disallowed-key. The token parameter is handled by authentication middleware on ring and not by compojure-api. Is there a way to allow a parameter on all endpoints without writing it on all endpoints?

ikitommi 2018-05-09T19:47:46.000536Z

@kasuko what kind of paramerer that is? extra body parameter?

kasuko 2018-05-09T20:02:58.000351Z

url parameter

ikitommi 2018-05-09T20:47:41.000165Z

url? you can add the parameter definition into a context too, and it gets accumulated into leafs. Something like:

(api
  (context "/api/:token" []
    :path-parameter [token :- s/Int]
    (GET "/" []
      (ok token))
    (POST "/" []
      (ok token))))

kasuko 2018-05-10T16:44:36.000529Z

Oh whoops, I meant query parameter but I can modify this. Thanks for the help!