-
Notifications
You must be signed in to change notification settings - Fork 280
Description
Hi, Team.
I found that there had been an issue #509 and fix #511 with regards to the file upload through the multipart/form-data content type. However, when I checked the source code, it only partially covers the cases.
-
According to the OpenAPI v3.0.1 spec, file input/output can be the schema type/format of
string/binaryorstring/base64. However, the codebase only looks after thestring/binarypair.OpenAPI.NET/src/Microsoft.OpenApi/Models/OpenApiOperation.cs
Lines 233 to 236 in a636ec2
if (paramSchema.Type == "string" && paramSchema.Format == "binary") { paramSchema.Type = "file"; paramSchema.Format = null; } -
According to the 3.0.1 spec, it's valid to have schema reference (the
$refvalue) under therequestBody/content/<media-type>/schemaobject instead of thepropertiesobject. However, the current codebase only looks after thepropertiesobject.foreach (var property in RequestBody.Content.First().Value.Schema.Properties)
Therefore, these two issues need to be resolved for proper V3 ➡️ V2 conversion. The Azure Functions OpenAPI extension has addressed this issue, which relies on this OpenAPI.NET package.