I have a web project with a Web API 2 controller, and I added the Swashbuckle nuget package to it. When I access the swagger UI it displays my controller operations correctly.
Web API Controller example:
public class StatusEventController: ApiController
{
[HttpPost]
[ApiKeyAuthentication]
[Route("api/v1/statusevent/reportstatus/{locale}")]
public ReportStatusResponse ReportStatus(string locale, [FromBody]StatusType status)
{
ReportStatusResponse response = new ReportStatusResponse();
try
{
// Business logic here...
response.Success = true;
}
catch (Exception ex)
{
Status.ResponseMessage message = new Status.ResponseMessage();
message.Code = "EX";
message.Message = ex.Message;
response.Messages.Add(message);
}
return response;
}
}
Some of my controller methods uses parameters that are defined in another (included) library, and those types are all displayed as being the data type "string". Parameters of types that are defined in the web project itself are displayed correctly. All types used in the Web API are simple POCO objects.
The POCO:s all looks like this:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://services.info/status/Status", TypeName="ReportStatusResponse")]
[System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
public partial class ReportStatusResponse
{
protected bool m_Success = false;
protected List<ResponseMessage> m_Messages = new List<ResponseMessage>();
public bool Success
{
get { return m_Success; }
set { m_Success = value; }
}
public List<ResponseMessage> Messages
{
get { return m_Messages; }
}
}
I created a test project with a Web API project and an external library, and that one works as expected, so I can't reproduce the problem outside of my project.
How do i troubleshoot/solve this problem?