ring-swagger 2018-10-24

@petr.mensik could you explain your use case bit more? There are several ways…

I plan to feed it to the AWS API Gateway to automate API creation and update directly from code. I might also use this project which expects swagger.json in target folder https://github.com/trieloff/lein-aws-apigateway

@petr.mensik One way is to ask the generated out of an app:

(require '[compojure.api.swagger :as swagger])

;; the app
(def app ...)

(app {:request-method :get, :uri (swagger/swagger-spec-path app)})

the default swagger-endpoint is named :compojure.api.swagger/swagger and that function uses the reverse-routing to find the uri and then you just ask the response.

(defn swagger-spec-path
  [app]
  (some-> app
          routes/get-routes
          routes/route-lookup-table
          ::swagger
          keys
          first))

not documented that well, but one can get the reverse-routing tree out of an app, and lot’s of other things too.

Sounds like a good option, thank you! haven't thought of reverse routing