Fork me on GitHub

@vale depends on the coercion model you are using. There could be more examples on the docs. PRs welcome. Some samples:

;; schema
(require '[schema.core :as s])
:query {:x s/Int, (s/optional-key :y) s/Int}

;; data-specs
(require '[ :as ds])
:query {:x int?, (ds/opt :y) int?}

;; clojure.spec
(require '[clojure.spec.alpha :as sa])
(require '[spec-tools.spec :as spec])
(sa/def ::x spec/int?)
(sa/def ::y spec/int?)
:query (sa/keys :req-un [::x] :opt-un [::y])
... should all do the same.


@yogthos no helpers currently in reitit for upload (or download), I think there should be, in reitit-ring module. Ideas welcomr on what would be a easy syntax to define those.


Currently, one can use the normal ring middleware for multipart, but I think we can do better.


1) the schemas for multipart for schema & spec 2) mw to read the params for multipart/form-data (could be a format in Muuntaja? 3) data-driven syntax to pull the params, maybe after rhe openapi3 additions?

:content {"multipart/form-data" {:body {:name string?, :file file?}}}


the 3rd explained: for the multipart-endpoints, there is only one content-type allowed, Muuntaja format parses that (and emits the openapi-docs).


btw, currently on vacation, back to computer in few weeks..

👍 8

Weird, if I add :compile reitit.coercion/compile-request-coercers to my ring router, all my responses become 405 code.