ring-swagger & compojure-api
twashing 2018-04-12T00:13:08.000250Z

How would I disable middleware (in metosin/compojure-api), for nested routes. For example, how do we remove parent-middleware application for the “child” context. In this case, I just want the child-middleware.

(context "parent" []
  :middleware [parent-middleware]
  (context "child" []
    :middleware [child-middleware]

twashing 2018-04-12T02:51:49.000107Z

So taking this a bit further, I was going through the source of composure.api.integration-test, and it seems that having nested :middleware definitions, is additive. http://metosin.github.io/compojure-api/doc/index.html

twashing 2018-04-12T02:57:45.000183Z

Does anyone know if there’s any way in compojure-api api documentation (declaratively or programmatically), that let’s you reset middlewares?

ikitommi 2018-04-12T09:19:13.000345Z

@twashing currently, there is no easy way, as it's based on Compojure and routing trees are programs and mw are applied in place.

ikitommi 2018-04-12T09:23:43.000429Z

with metosin/reitit, it would be easy:

["/parent" {:middleware [parent-middleware]}
 ["/child {:middleware ^:replace [child-middleware]}]]

twashing 2018-04-12T16:12:36.000465Z

@ikitommi Hmm, very interesting. Thanks for the context. That helps a lot.