I might be overlooking something, but are there any docs/examples for uploading files in yada?
There is an upload example in the codebase. git grep upload
This is becoming a frequently asked question. I must add this to the docs!
one file: https://github.com/juxt/yada/search?utf8=%E2%9C%93&q=upload+extension%3Aclj&type=Code
Let me look
Ah, thanks. I found an example with :consumer
somewhere, but I didn’t find any docs on it
I’ll try this
I’m not trying a multipart/form-data approach, but I’m running into the same issues as this guy here: https://clojurians-log.clojureverse.org/yada/2017-03-13.html
any working examples with file upload + some other fields would def. be helpful
This kind of works:
:consumes #{"multipart/form-data"}
:parameters {:form {:skip s/Str
:pdf ring.swagger.upload/TempFileUpload}}
but I have to include an extra dependency to make that work… https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/upload.clj#L8… I could also just copy the implementation… :-S
and skip
is not coerced anywhere, not sure if that should work or not
Got an exception in this place: https://github.com/juxt/yada/blob/master/ext/multipart/src/yada/multipart.clj#L664 java.lang.ClassCastException: manifold.deferred.ErrorDeferred cannot be cast to clojure.lang.Associative
I guess assoc-body-parameters returns an error-deferred and that’s where this error comes from: https://github.com/juxt/yada/blob/master/ext/multipart/src/yada/multipart.clj#L605
lol, this was the error:
{:pdf {:content-disposition disallowed-key, :request-headers disallowed-key, :type disallowed-key, :debug disallowed-key, :headers disallowed-key, :filename missing-required-key, :content-type missing-required-key, :pieces disallowed-key, :body-offset disallowed-key}}
so it seems Schema validations on multipart form uploads is not supported or I have to adapt the ring-swagger stuff a bitNo. It's definitely not supported for multipart uploads
Not to say it couldn't be, but the code for each was written separately
Is there a way I could have file uploads from the swagger API + some other fields mixed in yada currently?
I could work around it and make the query parameters do the other job
Opened an issue for this a few months back, haven't got time to send a PR though. https://github.com/juxt/yada/issues/212