based on docs from here: https://github.com/metosin/compojure-api/blob/master/src/compojure/api/core.clj , defapi is the following macro:
(defmacro defapi
[name & body]
`(def ~name
(api ~@body)))
as you can see it just defines var with the result of api
macro call (and api
creates a ring handler)
so you could use it without defapi, and wrap ring session:
(def app
(-> (api (swagger-ui)
(swagger-docs
{:info {:title "Sample api"}})
(GET* "/" []
:no-doc true
(ok "hello world"))
(context* "/api" []
:tags ["thingie"]
(GET* "/plus" []
:return Long
:query-params [x :- Long, {y :- Long 1}]
:summary "x+y with query-parameters. y defaults to 1."
(ok (+ x y))
ring.middleware.session/wrap-session))
I guess after that you should be able to use the session normally, as described in https://github.com/ring-clojure/ring/wiki/Sessions . Haven't tester it, but i think it's the right way