reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
Matheus Moreira 2020-06-09T09:44:16.094400Z

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.

ikitommi 2020-06-09T12:29:53.095500Z

yes, depends on the coercion impl used, for spec, here's and example: https://github.com/metosin/reitit/blob/master/examples/http-swagger/src/example/server.clj#L32-L37

ikitommi 2020-06-09T12:30:37.096700Z

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

1
ikitommi 2020-06-09T12:31:00.097200Z

doc improvements welcome btw :)

moonbrv 2020-06-09T16:01:13.099600Z

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

moonbrv 2020-06-09T16:08:07.101100Z

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

juhoteperi 2020-06-09T19:31:40.103100Z

@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.

moonbrv 2020-06-09T19:42:30.103200Z

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!

gekkostate 2020-06-09T21:33:44.105400Z

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?

gekkostate 2020-06-09T21:54:58.105700Z

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