reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
Ilari Tuominen 2020-07-01T12:38:59.189100Z

Hi, I’m having a bit of problems with swagger.json generation with reitit. My idea is to run my app with two sets of routes, where the public one is swagger-documented but the private one is not.

(defn routes []
   ["/public" public-route-configuration
    
   ;; swagger documentation
    ["" {:no-doc true
         :swagger {:info {:title "Public"
                          :description "Public api for external service integration"}}}

     ["/swagger.json"
      {:get (swagger/create-swagger-handler)}]

     ["/api-docs/*"
      {:get (swagger-ui/create-swagger-ui-handler
             {:url "/api/swagger.json"
              :config {:validator-url nil}})}]]

    ["/ping"
     {:no-doc true
      :get (constantly (ok {:message "pong"}))}]

    (rest-of-public-routes)]

  ["/private" private-route-configuration
   
   (rest-of-private-routes)])
For some reason if I add the private route the swagger.json generation fails silently. Is this something that is discouraged and therefore shouldn’t even work by design or should I put the swagger description on the top level instead and mark them with :no-doc?