Fork me on GitHub
#reitit
<
2019-11-05
>
meguru02:11:28

Hello, I used reitit and reitit-swagger in Luminus framework, I found an argument, {:swagger {:security []}}

clojure
["/authping"
 {:get {:summary "auth ping"
  :middleware [authorized?]
  :swagger {:security []}}
  :response {200 {:body "OK"}}
  :handler (fn [] {:status 200 {:body "OK"}})}
]
how to use it? please let me know any document...

ikitommi05:11:53

@e.tmailbank here's the swagger spec guide, hope it helps: https://swagger.io/docs/specification/2-0/authentication/ A reitit-spesific guide would be nice, if someone has time to contribute such.

👍 4
ikitommi05:11:25

the :securityDefinitions can be added to the swagger-spec route, :security to routes that apply those rules.

meguru11:11:34

@ikitommi Thanks! I can try basic authorization!

niwinz15:11:22

I think i found a bug in sieppari:

(require '[sieppari.core :as sp]
         '[sieppari.async.promesa])

(def noop-interceptor
  {:enter identity
   :leave identity})

(defn async-inc
  [v]
  (-> (p/delay 100 (inc v))
      (p/then (fn [v]
                (throw (ex-info "error" {}))))))

(defn test-execute
  []
  (let [d (p/deferred)]
    (sp/execute [noop-interceptor async-inc] 1 #(p/resolve! d %) #(p/reject! d %))
    d))

@(test-execute) ;; blocks forever

niwinz15:11:20

this is the code that i expect to work (returning an rejected cfuture) but it blocks forever

niwinz15:11:53

if handler returns a rejected cfuture the reject callback passed to sp/execute is never executed ...

niwinz15:11:06

seems like on develop this is already fixed