Fork me on GitHub
#reitit
<
2021-04-29
>
wombawomba15:04:49

So I'm using Reitit with Schema for validation, and I've run into a situtation where Reitit discards some type information that I need when validation fails. Specificially, it calls schema.utils/error-val here: https://github.com/metosin/reitit/blob/master/modules/reitit-schema/src/reitit/coercion/schema.cljc#L89. I'd like for it to just do (if schema.utils/error? coerced) (coercion/map->CoercionError {:schema schema, :error coerced}) instead. How can I make this happen?

matheusashton23:04:31

Hello, I just started with Reitit, found it awesome, but I have some doubts, I'm using reitit with ring, I was reading about rote data https://cljdoc.org/d/metosin/reitit/0.5.13/doc/basics/route-data, it's a great feature! But what if I want all my routes have access to the same data? I tried to put it in the top level but it didn't work:

(defn app
  [deps]
  (ring/ring-handler
   (ring/router ["/api"
                 ["/funds" {:name ::funds-list
                            :get handler}]])
   {:data {::deps deps}}))
if I try to access request data with (println (-> req ring/get-match :data)) it retruns only {:name :fiis-api.service/funds-list, :get {:handler #object[fiis_api.service$handler 0x3e71ff8 fiis_api.service$handler@3e71ff8]}}

matheusashton23:04:41

also is there a way to do an auto reload after files changed for development?