Fork me on GitHub
#reitit
<
2019-11-19
>
ikitommi06:11:09

@souenzzo reitit doesn’t expose the internal route AST, but there is a public fn in reitit.impl to parse the route strings:

(->> [["/a/{user/id}/b"]
      ["/b"
       ["/{user/id}"
        ["/c"]
        ["/d"]]]
      ["/e/{user/name}"]
      ["/f"]]
     (r/router)
     (r/routes)
     (filterv #(-> %
                   first
                   (impl/parse nil)
                   :path-params
                   :user/id)))
;[["/a/{user/id}/b" {}] 
; ["/b/{user/id}/c" {}] 
; ["/b/{user/id}/d" {}]]

👍 4
ikitommi06:11:46

maybe the reitit.core/compiled-routes could expose the AST for easier programmatic queries

ikitommi19:11:54

btw, we started #malli for those interested in data-driven schemas. Will be integrated into reitit soon. Just got support for closed dispatch :multi schemas.