Fork me on GitHub
#reitit
<
2020-06-04
>
orestis11:06:44

I’m looking at reitit.frontend.controllers — is there a way to “hang” some data to the match object? Or are the start/stop functions only for side effects?

orestis11:06:12

Looking at the code, it seems not.

manutter5112:06:35

I’d look at the identity function, it takes a match and returns an arbitrary value, so a good place to hook in some extra data before it gets passed to start/stop

juhoteperi12:06:18

Apply-controllers is also just a 50 lines of code and you are calling it from your route change handler, you could just call your own code from the same place, no need to use controllers for this.

orestis12:06:18

@juhoteperi yeah this is what I ended up doing. Literally 2 lines of code 😄

👍 4
Tanel18:06:26

Is there a way to have optional query parameters when coercing with clojure.spec? I have the following, but the request fails if parameters are missing:

{:get {:parameters {:query {:limit int?
                            :offset int?}}
Edit: Nevermind, I solved it by using your `spec-tools.data-spec/opt`