I'm trying to include a bad request (400) response schemas in the open api document for the web api I'm building in .NET 6. The problem is, the media type always defaults to application/octet-stream
even though I explicitly set it to application/json
.
My controller is decorated with the following attribute:
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(BadRequestResult), (int)HttpStatusCode.BadRequest, "application/json")]
But, the media type for the response 400
is incorrect in the generated open api document:
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Foo"
}
}
}
},
"400": {
"description": "",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
Am I missing something or is this a bug in NSwag?