Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
requestBody
in swagger.json
of the code below
app.MapPut("/file", Created (HttpRequest request) => {
return TypedResults.Created("https://example.org");
})
.Accepts<byte[]>("application/zip")
.Produces(StatusCodes.Status415UnsupportedMediaType)
is
"requestBody": {
"content": {
"application/zip": {
"schema": {
"type": "string",
"format": "byte"
}
}
}
}
while .Accepts<Stream>("application/zip")
leads to
"requestBody": {
"content": {
"application/zip": {
"schema": {
"$ref": "#/components/schemas/Stream"
}
}
}
}
When I want to override requestBody
by adding
.WithOpenApi(o => {
o.RequestBody = new OpenApiRequestBody {
Content = new Dictionary<string, OpenApiMediaType>() {
{
"application/zip",
new OpenApiMediaType {
Schema = new OpenApiSchema {
Type = "string",
Format = "binary"
}
}
}
}
};
return o;
});
I find that it has no effect.
How to set format to binary
?
.NET Version
7.0.100