feat: generate correct openapi for reitit.ring.malli

This commit is contained in:
Joel Kaasinen 2023-03-16 09:53:38 +02:00
parent 83b747c7c6
commit b5c9ee274d
2 changed files with 6 additions and 7 deletions

View file

@ -4,7 +4,8 @@
#?(:clj #?(:clj
(def temp-file-part (def temp-file-part
"Schema for file param created by ring.middleware.multipart-params.temp-file store." "Schema for file param created by ring.middleware.multipart-params.temp-file store."
[:map {:json-schema {:type "file"}} [:map {:json-schema {:type "string"
:format "binary"}}
[:filename string?] [:filename string?]
[:content-type string?] [:content-type string?]
[:size int?] [:size int?]
@ -13,7 +14,8 @@
#?(:clj #?(:clj
(def bytes-part (def bytes-part
"Schema for file param created by ring.middleware.multipart-params.byte-array store." "Schema for file param created by ring.middleware.multipart-params.byte-array store."
[:map {:json-schema {:type "file"}} [:map {:json-schema {:type "string"
:format "binary"}}
[:filename string?] [:filename string?]
[:content-type string?] [:content-type string?]
[:bytes bytes?]])) [:bytes bytes?]]))

View file

@ -11,6 +11,7 @@
[reitit.http.interceptors.multipart] [reitit.http.interceptors.multipart]
[reitit.openapi :as openapi] [reitit.openapi :as openapi]
[reitit.ring :as ring] [reitit.ring :as ring]
[reitit.ring.malli]
[reitit.ring.spec] [reitit.ring.spec]
[reitit.ring.coercion :as rrc] [reitit.ring.coercion :as rrc]
[reitit.swagger-ui :as swagger-ui] [reitit.swagger-ui :as swagger-ui]
@ -434,11 +435,7 @@
(deftest multipart-test (deftest multipart-test
(doseq [[coercion file-schema string-schema] (doseq [[coercion file-schema string-schema]
[[#'malli/coercion [[#'malli/coercion
[:map {:json-schema {:type "string" reitit.ring.malli/bytes-part
:format "binary"}}
[:filename :string]
[:content-type :string]
[:bytes :int]]
:string] :string]
[#'schema/coercion [#'schema/coercion
(schema-tools.core/schema {:filename s/Str (schema-tools.core/schema {:filename s/Str