-
Notifications
You must be signed in to change notification settings - Fork 937
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
File upload input not shown with swagger ui using swagger-php with OA #666
Comments
birendragurung
changed the title
File is not uploaded with swagger ui using swagger-php with OA
File upload input not shown with swagger ui using swagger-php with OA
Apr 8, 2019
Try this, /**
* ...
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* @OA\Property(
* property="documentType",
* description="documentType",
* type="file",
* @OA\Items(type="string", format="binary")
* ),
* ),
* ),
* ),
*
* @OA\Response(response=200,description="successful operation",
* @OA\MediaType(mediaType="application/json")
* ),
* @OA\Response(response=400, description="Bad request"),
* @OA\Response(response=404, description="Resource Not Found"),
* )
* ...
*/ |
I am using this for regular properties + multiple file uploads in a single post. NOTE Support for multiple file uploads in a single request is borked in swagger-ui. See swagger-api/swagger-ui#4600 * @OA\RequestBody(
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#components/schemas/item"),
* @OA\Schema(
* @OA\Property(
* description="Item image",
* property="item_images[]",
* type="array",
* @OA\Items(type="string", format="binary")
* )
* )
* }
* )
* )
* ), Single file upload should be: * @OA\RequestBody(
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* allOf={
* @OA\Schema(ref="#components/schemas/item"),
* @OA\Schema(
* @OA\Property(
* description="Item image",
* property="item_image",
* type="string", format="binary"
* )
* )
* }
* )
* )
* ), |
I'm closing this issue as it is not a bug/limitation of swagger-php. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to test my API and I have to upload a file.
But I am not able to write proper annotation for uploading file using swagger ui..
How can I do it?
The text was updated successfully, but these errors were encountered: