Fork me on GitHub
#reitit
<
2023-03-08
>
danielneal10:03:32

Is there a built in function to transform all the keys in a schema using a function (e.g to transform dash to underscore) or should I use a schema walker?

dharrigan11:03:20

Do you mean going out on the wire, i.e., as json?

danielneal11:03:13

I mean transforming the schema definition itself, as opposed to the value.

dharrigan11:03:07

ah, no - no idea - sorry.

lepistane11:03:57

Does anyone have most recent reitit with CORS enabled and code how to do it? This doesn't seem to be working anymore and i really can't spend hours on this again. https://clojurians.slack.com/archives/C7YF1SBT3/p1671827643059279?thread_ts=1671806291.270689&amp;cid=C7YF1SBT3

lepistane11:03:54

Oh i see that you updated it. I might steel all of it to be honest and just plug it in. I will let you know if all goes well. Thanks!

dharrigan11:03:58

steal away 🙂

lepistane11:03:03

🙇 I'd also like to mention that i moved CORS at the beginning of the middleware chain and it seems that it solved the issue. How it worked with other service which had ring-cors at the end of the chain - i have no clue. Felling quite stupid at the moment. Thanks a lot for your time and generosity @U11EL3P9U

dharrigan11:03:17

you're most welcome 🙂

fuad14:03:03

I have ring-cors as a middleware at the ring handler level:

(defn handler [components]
  (ring/ring-handler
   (router components)
   (constantly {:status 404 :body "Not Found"})
   {:middleware [middleware/wrap-cors
                 (middleware/wrap-resources components)]}))
and ::ring/default-options-endpoint nil in the router options.