Skip to content

Commit a127105

Browse files
author
Adit Sheth
committed
Fix OpenAPI schema generation for FileContentResult to use binary format
1 parent d72b3c2 commit a127105

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ internal sealed class OpenApiSchemaService(
5858
TransformSchemaNode = (context, schema) =>
5959
{
6060
var type = context.TypeInfo.Type;
61-
// Fix up schemas generated for IFormFile, IFormFileCollection, Stream, and PipeReader
61+
// Fix up schemas generated for IFormFile, IFormFileCollection, Stream, PipeReader, and FileContentResult
6262
// that appear as properties within complex types.
63-
if (type == typeof(IFormFile) || type == typeof(Stream) || type == typeof(PipeReader))
63+
if (type == typeof(IFormFile) || type == typeof(Stream) || type == typeof(PipeReader) || type == typeof(FileContentResult))
6464
{
6565
schema = new JsonObject
6666
{
6767
[OpenApiSchemaKeywords.TypeKeyword] = "string",
6868
[OpenApiSchemaKeywords.FormatKeyword] = "binary",
69-
[OpenApiConstants.SchemaId] = "IFormFile"
69+
[OpenApiConstants.SchemaId] = type == typeof(FileContentResult) ? "FileContentResult" : "IFormFile"
7070
};
7171
}
7272
else if (type == typeof(IFormFileCollection))

0 commit comments

Comments
 (0)