-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable multiple file support? #254
Comments
Can't you already accomplish this by simply having more than one parameter with Or am I missing something? |
@BigstickCarpet - the idea is to allow an undefined number of files to upload. You can set several individual parameters but that's not quite the same. |
Ah, ok. 👍 |
Any thoughts on this? multiple file upload (where the user decides how many files to upload) seems like a really common use case. |
So following #50, we may be able to allow the declaration of an array of |
Any progress on this? |
Most likely part of 3.0 |
Currently this should be possible with:
If the documentation could be adapted to:
|
Please note that this is currently not specified and it may be the case that this changes in a future version of the specification. An upload can be handled with the following definition: - name: files in: formData description: Upload multiple files required: true type: array items: type: File collectionFormat: multi Relates to: OAI/OpenAPI-Specification#254
A new approach has been introduced in the V3 spec to model multi-part forms included files. The |
@darrelmiller Are you meaning to say that uploading e.g. an array of files is now possible? I guess the requestBody:
content:
multipart/mixed:
schema:
type: object
properties:
id:
# default is text/plain
type: string
format: uuid
address:
# default is application/json
type: object
properties: {}
profileImages:
# default is application/octet-stream, need to declare an image type only!
type:array
items:
type: string
format: binary
encoding:
profileImages:
# only accept png/jpeg
contentType: image/png, image/jpeg
style: form
explode: true How would the form images be named in the request? |
I know we discussed this scenario and it was intended to support it. I don't believe style needs to be used here because style is a serialization hint and binary streams of images are not going to be encoded with key value pairs. As for how the naming of the parts is defined, I'm not sure, but your suggestion does make sense. We got to a point with the definition of the multi-part stuff where we felt we needed to actually try implementing some of the scenarios before we rat-holed on trying to get the definition airtight. |
We should have made it clearer in the spec - iirc, As for the naming, what @darrelmiller said. |
Any progress on this? Open since ~3yrs and counting ... |
@tuxedo0801 , actually OpenAPI 3.0 supports defining multi-file upload.
|
This seems to be the same issue: OAS 3: Support for uploading an array of files in multipart requests #4600 |
I made a quick dirty fix for this issue in my fork: I think |
This is so basic. Can you guys implement it? The incompleteness of OpenAPI 2 vs. HTTP features is a real pain point. IT's not optional to support all the features of HTTP |
@Cloudmersive OpenAPI 2 is no longer under active development so the solution here is to move to OpenAPI 3. @darrelmiller @webron is there any reason to keep this open? Per #254 (comment) it's solved in OAS 3.0, and the rest of the links and comments here are about tooling support or OAS 2.0 Also, is there an official statement that OAS 2 is no longer in active development? I couldn't find one offhand but I know it's been said somewhere. |
Yeah, I think with a bit of creativity you can describe this scenario with OpenAPI V3. I'm ok with closing this and let some open an new issue if they find there is something they cannot do. There is no more work on-going on OpenAPI V2. |
For imitation form-data do this:
|
Any progress as this is open for 3 years ?? |
This is crazy, if there is no a better documentation on this from Swagger UI! |
While not explicitly allowed, it seems we might want to enable type: file inside arrays to allow for support of multiple files.
The text was updated successfully, but these errors were encountered: