Fork me on GitHub
#yada
<
2017-04-04
>
borkdude18:04:08

Is there a reason why I have to pass the route-params here, while they are already available in the context?

(yada/url-for c ::record {:route-params {:pmid “123”}})
PS: it would be a nice addition to the manual, wasn’t obvious to me how I should pass :pmid, although the error said it was missing

kardan18:04:06

Maybe I’m speaking without thinking enough here, but is not the route-params in the ctx for the current request but the ones passed into url-for related to the url for what you ask for? Maybe you want the url for another pmid?

borkdude18:04:26

Yes, that’s a good one of course.

malcolmsparks18:04:32

Yes. You're creating a link to another web resource. Leaking through the current path params might yield nasty surprises. (Principle of Least Surprise)

borkdude18:04:56

yeah, that makes sense. I had to search through Github examples how to pass the param, found it here: https://github.com/juxt/yada/blob/432d1b25f83a4af5d94d1108f37ee253a2a74bce/examples/phonebook/src/phonebook/resources.clj#L135

borkdude18:04:21

@malcolmsparks I could make a PR to add an example to the manual if you want?

malcolmsparks18:04:51

Yes please. The manual could use some help