I have a controller method:
/// <summary>
/// Test api
/// </summary>
/// <param name="fromForm">from form</param>
/// <returns>result</returns>
[HttpPost("test")]
public string Test([FromForm] string fromForm)
{
return "result";
}
Then im using Swashbuckle for the swagger UI, but the description "from form" is not displayed in the swagger UI, Im switching between Swashbuckle version 5.5 and 6.1 but the result is still the same,
The description is displayed correctly when removing FromForm, I've tried to use SwaggerRequestBody annnotation, also added IncludeXmlComment in Startup.cs and also GenerateDocumentationFile in csproj as well but still no luck
Edit: This is the result that I get from swagger.json, noticed that the param is inside "requestBody" not "parameters",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"fromForm": {
"type": "string"
},
}
},
"encoding": {
"fromForm": {
"style": "form"
}
}
}
}
},
Edit 2:
I went through the OpenApi code and saw that when using FromForm, my parameters is inside the RequestBody properties and the type is OpenApiEncoding. When not using FromForm, the parameters is inside Parameters properties with type OpenApiParameter, and there is no code to write the description in OpenApiEncoding