Fork me on GitHub
Janne Sauvala13:01:52

Hi 👋:skin-tone-2: what is the status of adding OpenAPI3 support ( I noticed that there has been progress on the linked issues


yes, both spec-tools and schema-tools now have OpenAPI3 support. Just need to be glued together. I think it could start ass an option to swagger. Once it’s tested, could toss away the swagger. Anyone interested in implementing that?


@UJZ6S8YR2 I started working on the malli side of OpenAPI3 last autumn but haven't had time to make progress on it for a few months. Now I should be able to progress with it again. I can start to glue the existing solution after that if no one else has started yet

Janne Sauvala10:02:12

@UDCB49XK3 great news and thanks!

Malik Kennedy20:01:43

Is there a way to both add something to the response map AND redirect with the new response map? I tried doing something like this but, unless I am missing something else, the key-value pair I added doesnt appear to affect the route that I redirect to.

(defn login-handler [request]
  (let [session (get-in request [:session])
        email (get-in request [:params :email])
        password (get-in request [:params :password])
        valid?   (hashers/verify
                   (db/get-user-by-email {:email email})))]    
    (if valid?
        {:status 200
         :body {:identity (jwt/create-token {:id email})}}
        (resp/redirect "/me"))
      (bad-request {:auth [email password]
                    :message "Incorrect Email or Password."}))))


Your do block is defining a map with 2 keys, throwing that map away, and returning the result of calling resp/redirect, which I don’t think is what you intend.

❤️ 3

resp/redirect wants to return a response with a 302 status code, an empty body, and a Location header with the new URL. You could munge the body and put your identity value in there, but I’m not sure what will happen on the client side if you do.


you could try just manually returning

{:status 302
 :headers {"Location" "/me"}
 :body {:identity (jwt/create-token {:id email})}}
and see where that gets you.

❤️ 3
Malik Kennedy20:01:50

Thanks, that gets the redirect working.