api-management-developer-portal icon indicating copy to clipboard operation
api-management-developer-portal copied to clipboard

File upload not working for multipart/form-data

Open Yogesh-BK opened this issue 4 years ago • 12 comments

Bug description

When we publish an api using openApi specification and add an endpoint with request body "content-type = multipart/form-data", we are not able to see the Upload file option in developer portal

image

Reproduction steps

  1. Add an api using openApi specification
  2. Add an endpoint with the request body "content-type = multipart/form-data"
  3. Open the developer portal, go to the endpoint and click on the Try it button
  4. Upload file option is not displayed

Expected behavior

Upload file option should be displayed

Is your portal managed or self-hosted?

Managed

Environment

  • Operating system: MacOs Big Sur
  • Browser: Google Chrome

Additional context

Following observations:

  1. Json for openApi specification for swagger and APIM are different
  2. Differences that we observed
    1. schema type is not added in requestBody -> content -> multipart/form-data in APIM openApi specification
    2. format for schema -> properties -> fileName is not added in requestBody -> content -> multipart/form-data in APIM openApi specification
    3. encoding -> fileName -> style is not added in requestBody -> content -> multipart/form-data in APIM openApi specification

Swagger openApi Specification:

image

APIM openApi Specification:

image

Yogesh-BK avatar Oct 18 '21 10:10 Yogesh-BK

@Yogesh-BK, thank you for opening this issue. We will triage it within the next few business days.

ghost avatar Oct 18 '21 10:10 ghost

@Yogesh-BK We support multipart/form-data in OpenAPI v2: https://swagger.io/docs/specification/2-0/file-upload There is currently a bug with OpenAPI v3 support, where "format: binary" isn't accepted by API Management. As a workaround, you can use "type: file" to have the upload file selector visible in the developer portal.

(edited by @mikebudzynski for clarity)

ygrik avatar Oct 20 '21 16:10 ygrik

@Yogesh-BK, thank you for reporting the bug.

ghost avatar Oct 20 '21 17:10 ghost

@ygrik Thanks for your response, It would be great if you could share the expected timeline of this getting fixed and released. When we try to use the type: file, we are getting the warning as below but this warning doesn't stop us to hit the api and it seems irrelevant.

image

Yogesh-BK avatar Oct 21 '21 08:10 Yogesh-BK

@Yogesh-BK good catch. I fixed the warning to stop making requests https://github.com/Azure/api-management-developer-portal/pull/1492

ygrik avatar Oct 21 '21 20:10 ygrik

@ygrik Is there any particular reason for limiting the size of files to 3 mb? Can this size limit be increased to some extent? Also, Could you share the expected timeline for the above bug fix?

Yogesh-BK avatar Oct 22 '21 06:10 Yogesh-BK

@Yogesh-BK The 3Mb limit is inherited from the deprecated developer portal. We can introduce a setting to allow you to overwrite that limit.

The multipart/form-data fix for OpenAPI v3 will be released with a regular API Management service release. At this moment we don't have an ETA to share, but it should be available in the first quarter of 2022.

(edited by @mikebudzynski for clarity and to provide release ETA)

ygrik avatar Oct 27 '21 21:10 ygrik

What would be expected timeline for getting this issue fixed?

char000 avatar May 30 '22 05:05 char000

Pinging @mikebudzynski ;) Is there an eta for getting this issue fixed?

StefanPuntNL avatar Jul 06 '22 13:07 StefanPuntNL

Is there an update on this? We're more than a year past the ETA of first quarter 2022, so it'd be nice to get more information.

cboschert-allegion avatar Aug 28 '23 22:08 cboschert-allegion

Any news please?

NickBerto84 avatar Oct 09 '23 10:10 NickBerto84

@ygrik @JMach1 we are stuck here because we are using the generated openapi spec from APIM to be consumed and this 2 feature are blocking: 1 - Developer portal Multipart upload should be compatible with OpenApi Spec 3 (no changes in the spec need to be done) 2 - The developer poral should show upload file widget.

angusbreno avatar Mar 20 '24 15:03 angusbreno

This issue is related to managed developer portal. We advise you to create a Azure support request to get assistance on this issue. Please refer to the below link to create a new Azure support request, Please select Problem Type = "Developer Portal" in the request to route it appropriately.

https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

mrcarlosdev avatar Mar 29 '24 17:03 mrcarlosdev