我的Web API請求模型屬性:揚鞭Swashbuckle抽象類文檔
public List<Feature> Features { get; set; }
功能是一個抽象類。我得從它衍生出來的許多類:
public abstract class Feature
{
public string Title { get; set; }
}
public class ImageFeature : Feature
{
public string ImageUrl { get; set; }
}
顯然Swashbuckle只能識別Feature
性能,並相應產生的文檔。如何明確聲明Feature
類的可能實現,以便Swashbuckle生成適當的文檔?有一些屬性,我可以使用,像:
[SwaggerResponseType(typeof(ImageFeature))]
[SwaggerResponseType(typeof(AnotherFeature))]
public abstract class Feature
可能的重複:[swagger繼承](https://stackoverflow.com/questions/27862407/swagger-inheritance-and-composition) – Troopers
我使用這種方法 - https://stackoverflow.com/questions/34397349/how- DO-I-包括亞類功能於招搖-API的文檔,使用,swashbuckle –