script
1
Currently my swagger is handling single file upload successfully. But I want to change it to accept multiple files but i can’t figure out a way how .
This is the working code:
Path.parameter(:file, :formData, :file, "Browse File", required: true)
Thanks!
mbuhot
2
It looks like the swagger 2.0 spec allows for multiple form-data file parameters:
Multiple Upload
You can have several named file parameters, each defined individually:
parameters:
- in: formData
name: upfile1
type: file
required: true
- in: formData
name: upfile2
type: file
required: false
- in: formData
name: upfile3
type: file
required: false
However, uploading an arbitrary number of files (an array of files) is not supported. There is an open feature request at enable multiple file support? · Issue #254 · OAI/OpenAPI-Specification · GitHub. For now, you can use a binary string array as a workaround for uploading an arbitrary number of files:
Hi @mbuhot,
Is it possible in Swagger 3.0. If yes, how could implement it from phoenix?
Thanks
mbuhot
5
Looks like it is available in OpenAPI 3.0 specification, but the swagger-ui part is still unimplemented.
You can check out OpenApiSpex project if you are looking to target OpenAPI 3.0.