Fork me on GitHub
#reitit
<
2018-07-04
>
ikitommi07:07:13

@yogthos I think that would be the most familiar syntax, and it would be easy to implement.

ikitommi07:07:13

Still, the one needs to add the :consumes content-type tip for apidocs so it (only?) takes the multipart-requests.

ikitommi07:07:55

currently, the middleware can't emit route data, so needs to be defined explicitely. There is an issue of that, but nit sure if that (mw emitting route data) is a good idea.

ikitommi07:07:02

also, I like that the body would always be parsed into :body params, as there can be only one body in a request. Reading body from :multipart or :body depending on the content-type feels like a extra thing to remember.

ikitommi07:07:02

(there were also times when stuff was in :json-params depending on the mw stack)

ikitommi07:07:01

the multipart in the suggested format could be a standalone mw: 1) data-driven mw, with a :compile hook, checking if a [:parameters :multipart] and :coercion is defined, otherwise not mounting 2) compile a :string coercer for the model, without the TempFileUploads 3) do the multipart-thing and parameter coercion at request-processing time

ikitommi07:07:46

.. could be safely added to all routes. I think the ability to compile & conditionally unmout a mw is a really good feature.

ikitommi07:07:51

could be used to emit the swagger :consumes automatically. c-api allows this.

yogthos13:07:23

@ikitommi yeah that makes sense to me, hooking this in via middleware seems like a clean way to do it