This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-14
Channels
- # announcements (11)
- # babashka (82)
- # beginners (51)
- # calva (11)
- # cider (3)
- # clj-kondo (62)
- # cljdoc (10)
- # cljs-dev (22)
- # clojure (75)
- # clojure-boston (1)
- # clojure-brasil (3)
- # clojure-czech (4)
- # clojure-europe (49)
- # clojure-france (10)
- # clojure-italy (16)
- # clojure-nl (5)
- # clojure-uk (9)
- # clojurescript (69)
- # community-development (33)
- # conjure (12)
- # core-async (6)
- # cursive (2)
- # datalevin (7)
- # datomic (6)
- # graalvm (13)
- # gratitude (2)
- # honeysql (3)
- # introduce-yourself (1)
- # lsp (37)
- # nextjournal (62)
- # off-topic (29)
- # pathom (1)
- # quil (2)
- # reitit (4)
- # releases (2)
- # sci (1)
- # shadow-cljs (28)
- # spacemacs (10)
- # sql (1)
- # tools-build (3)
- # vim (3)
reitit + malli-lite for the curious:
• [metosin/reitit "0.5.16-SNAPSHOT"]
• https://cljdoc.org/d/metosin/reitit/0.5.16-SNAPSHOT/doc/coercion/malli#lite-syntax

I’m curious how I can coerce file uploads to byte streams. I have a route defined with a spec-based type that resolves to reitit.ring.middleware.multipart/bytes-part
. The generated Swagger UI allows me to upload the data, but the request ultimately fails with a spec error, I suppose that the file hasn’t been coerced to bytes? I can see the “Content-Type” of the request seems to be things like “text/csv” depending on what I send.
If I choose temp-file-part
, the requests succeed, and I can see a temp file has been written, which I’d be able to move. I’d prefer byte-streams though.
Does this problem seem like it’s on Swagger UI’s side? That it isn’t reading the swagger.json correctly? I can see the swagger.json is saying the content-type should be bytes:
{"/my_route":{"post":{"responses":{"default":{"description":""}},"consumes":["multipart/form-data"],"parameters":[{"in":"formData","name":"file","description":"","type":"file","required":["filename","content-type","bytes"],"properties":{"filename":{"type":"string"},"content-type":{"type":"string"},"bytes":{"type":"string","format":"byte"}} ...}
Perhaps I haven’t configured my coercer’s correctly? I’m using Pedestal, and I do have the (multipart/multipart-interceptor)
interceptor generator function called at the bottom of my interceptor chain’s declaration.