reitit 2025-03-24

Helloes everyone: I didn't find this in the documentation and not sure if it warrants adding it there but a tip about router data, meta-merge and meta-data. If you have a route like this:

(def routes
 ["config/update" {:name :config/set
                   :schema ^:replace namespace/schema}]

(ring/router
   ["/" {:middleware [auth/authentication]
         :schema [:map [:token :string]]}
    routes])
You'll notice that the schema replace doesn't actually work. It is presumably a quirk of Clojure language, the meta gets lost and meta-merge runs default behaviour. To fix it try this instead
["config/update" {:name :config/set
                  :schema (with-meta namespace/schema {:replace true}}]
Hopefully this helps someone else who scratched their head with the same thing.

👀 1