I have Web API request model with property:
public List<Feature> Features { get; set; }
Feature is an abstract class. I'll have many classes derived from it:
public abstract class Feature
{
public string Title { get; set; }
}
public class ImageFeature : Feature
{
public string ImageUrl { get; set; }
}
Obviously Swashbuckle only recognizes Feature
properties and generates documentation accordingly. How do I explicitly declare possible implementations of Feature
class so that Swashbuckle generate proper docs? Is there some attribute I could use, something like:
[SwaggerResponseType(typeof(ImageFeature))]
[SwaggerResponseType(typeof(AnotherFeature))]
public abstract class Feature