rodennis
2 years agoNew Member
Generating a schema for a generic list in c#
Hello im using swagger in a .NET API project, and trying to generate a schema from a generic list in C#. I have a class with a property of applicants, applicants can have types of applicant, or buisness. When I make the property a type of List<object> swagger ui is presenting value as a string. ex <Applicants>String</Applicants>
im trying to achieve something along the lines of the below
<UpdateSfsLoanStatusRequest>
<Applicants>
<Applicant>
</Applicant>
<Business>
</Business>
</Applicants>
</UpdateSfsLoanStatusRequest>
below is my class
public class UpdateSfsLoanStatusRequest
{
[XmlArray("Applicants")]
[XmlArrayItem("Applicant", Type=typeof(Applicant))]
[XmlArrayItem("Business", Type=typeof(Business))]
public List<object> Applicants { get; set; }
public class Applicant
{
}
public class Business
{
}
}
below is the request body swagger is generating
<UpdateSfsLoanStatusRequest> <Applicants>string</Applicants> </UpdateSfsLoanStatusRequest>
any help would be much appreciated.
Thanks