Fork me on GitHub
#reitit
<
2020-11-13
>
frankleonrose15:11:20

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.

frankleonrose16:11:41

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

ikitommi16:11:31

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

ikitommi16:11:44

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

ikitommi16:11:54

but, should work.

frankleonrose16:11:32

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

ikitommi16:11:56

yes, just wasted cpu cycles.