Fork me on GitHub

I’m setting up coercion, but I’m running into an exception. According to the docs:

The coercion middleware are compiled againts a route. In the middleware compilation step the actual coercer implementations are constructed for the defined models. Also, the middleware doesn't mount itself if a route doesn't have :coercion and :parameters or :responses defined.
So I should be able to declare routes like this:
(def routes
    {:middleware [:app.middleware/coerce-request

    ["/" ::home-page]]
    ;; More routes here that actually have coercions...
I make sure to pass in a map for :reitit.middleware/registry that includes the referenced middlewares. Still, when the routes are created and compiled, I get an exception claiming the middleware is not in the registry:
clojure.lang.ExceptionInfo: Middleware :app.middleware/coerce-request not found in registry.

Available middleware in registry:

|                                  :id |                                                                                                                                                                         :description |
|    :app.middleware/coerce-request | {:name :reitit.ring.coercion/coerce-request, :spec :reitit.spec/parameters, :compile #object[reitit.ring.coercion$fn__172563 0x194605f7 "[email protected]"]} |
|   :app.middleware/coerce-response |   {:name :reitit.ring.coercion/coerce-response, :spec :reitit.spec/responses, :compile #object[reitit.ring.coercion$fn__56703 0x36e4e57e "[email protected]"]} |
| :app.middleware/coerce-exceptions |                               {:name :reitit.ring.coercion/coerce-exceptions, :compile #object[reitit.ring.coercion$fn__56716 0x7a95f7d4 "[email protected]"]} |
|          :app.middleware/defaults |                                               {:name :app.middleware/wrap-defaults, :wrap #object[app.middleware$fn__212347 0x6b916d5 "[email protected]"]} |
It fails when compiling the home-page route, which does not have any coercion. Hence the coerce-request compile function returns nil, which causes into-middleware to throw. What am I missing here?


@msolli sounds like a bug, as the :app.middleware/coerce-request clearly is in the registry. Could you write an issue out of that?