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.
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
schema-tools and malli docs should show how it's done with them.
doc improvements welcome btw :)
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
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
@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.
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!
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?Sorted it out! The issue was with my router. 😛 Thanks!