reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
frankleonrose 2020-11-13T15:57:20.319700Z

Hi, all. What’s the right way to transform route data prior to passing it to reitit-ring/router? Say I want to add some additional [:swagger :tags] based on my own keys I’ve added at points in the tree. I looked at adding an :expand fn, but data coming in there is pre-meta-merge.

frankleonrose 2020-11-13T16:17:41.322100Z

Just reading up on composing routers. So would it be something like this? (-> route-defs ring/router ring/routes transform-routes ring/router)

ikitommi 2020-11-13T16:18:31.323300Z

@frankleonrose yes, there could be a new callback fn for this.

ikitommi 2020-11-13T16:19:44.324800Z

with the current workaround, it's doing the conflict resolution twice.

ikitommi 2020-11-13T16:19:54.325200Z

but, should work.

frankleonrose 2020-11-13T16:22:32.326500Z

Thanks! If I understand correctly, second pass on conflict resolution should result in no change (assuming my transform doesn’t change paths).

ikitommi 2020-11-13T16:37:56.328Z

yes, just wasted cpu cycles.