metosin / reitit

A fast data-driven routing library for Clojure/Script

Home Page:https://cljdoc.org/d/metosin/reitit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Plumatic Schema for multipart file uploads

opqdonut opened this issue · comments

Currently reitit.http.interceptors.multipart only has Clojure spec schemas for temp-file-part and bytes-part. Could also supply schema & malli versions.

See reitit.openapi-test/multipart-test for inspiration: https://github.com/metosin/reitit/pull/593/files#diff-c18bf86982356e8898ead05214985b1ffa8f85f77f47094ac56cf82cb5eb95b7R434

Related to #591

Oh, I just noticed we have reitit.ring.malli/temp-file-part and bytes-part as well.

As workaround I ended up using TempFileUpload from ring swagger. For this to work I needed to add this type to schema tools

(:require
             [schema-tools.swagger.core :as st-swagger]
             [ring.swagger.upload :as swagger-upload])

(defmethod st-swagger/transform-type swagger-upload/TempFileUpload [_ _] {:type "file"})