Here is one of the workarounds that you can try
For instance I have considered file my response to be an image/png and here is my function OpenAPI Function
[FunctionName(nameof(SampleFunction.Run))]
[OpenApiOperation(operationId: "run", tags: new[] { "multipartformdata" }, Summary = "Transfer image through multipart/formdata", Description = "This transfers an image through multipart/formdata.", Visibility = OpenApiVisibilityType.Advanced)]
[OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiRequestBody(contentType: "multipart/form-data", bodyType: typeof(MultiPartFormDataModel), Required = true, Description = "Image data")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "image/png", bodyType: typeof(byte[]), Summary = "Image data", Description = "This returns the image", Deprecated = false)]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "POST", Route = "form/multipart")] HttpRequest req,
ILogger log)
{
var files = req.Form.Files;
var file = files[0];
var content = default(byte[]);
using (var ms = new MemoryStream())
{
await file.CopyToAsync(ms).ConfigureAwait(false);
content = ms.ToArray();
}
var result = new FileContentResult(content, "image/png");
return result;
}
Its Model
public class MultiPartFormDataModel
{
public byte[] FileUpload { get; set; }
}
Here is the output for Image file :

Here is the output for Text file :

REFERENCES:
Azure Functions Binary Data Transfer via Swagger UI