Fork me on GitHub
#reitit
<
2020-06-09
>
Matheus Moreira09:06:16

hello. when using reitit’s ring-swagger integration, is there a way to “enrich” parameters and responses descriptions, e.g.: a text telling default values or the condition in which a certain response is returned? compojure-api has a describe function that seems to do it.

ikitommi12:06:37

schema-tools and malli docs should show how it's done with them.

ikitommi12:06:00

doc improvements welcome btw :)

moonbrv16:06:13

Hello, I have a question about controllers in reitit.frontend Is it possible somehow to get access in :start controller to old match? I have a task to send analytics and I need some path params from both: new and old matches

moonbrv16:06:07

for now, I just do (assoc new-match :old-match old-match ) before passing new match to the apply-controllers function, but I'm not sure if this is a right way to do so

juhoteperi19:06:40

@moonbrv Sounds ok. Also, if controllers dont fit your use case, you could just roll your own. If you are sending analytics in every route change, controllers might not be necessary for this? Just call analytics code on the on-navigate callback, where you are calling apply-controllers.

moonbrv19:06:30

I don't need to track every route change, only within a specific route group, but it is an excellent idea)) I can just add some unique key to route data to know if I need to dispatch some event when on-navigate happen. Thank you!

gekkostate21:06:44

Hi all, quick question. I’m using reitit in the frontend and wondering how the match is passed to view. For example, I have the following route:

["/abc/:id"
    {:name        :my-view
     :view        my-view
     :link-text   "SHELF"}]
and the following view
(defn my-view
    [match]
    (let [{:keys [path query]} (:parameters match)
        {:keys [id]} path
        _ (println match)]
    [:div
     [:h1 "Oh look new: " id]]))
However, the (println match) returns nil. So I was wondering how do I access parameters in a view?

gekkostate21:06:58

Sorted it out! The issue was with my router. 😛 Thanks!