I have a polymorphic model:
public class CreateOrderRequest
{
public List<CreateOrderItem> OrderItems { get; set; }
}
/// <summary>
/// Identifies a new item within an order
/// </summary>
[JsonConverter(typeof(CreateOrderLineJsonConvertor))]
[KnownType("GetKnownTypes")]
public class CreateOrderItem
{
public string OrderContext { get; set; }
public string OrderItemType { get; set; }
public static Type[] GetKnownTypes()
{
return new[]
{
typeof(OrderItemType1), typeof(OrderItemType2)
};
}
}
public class OrderItemType1: CreateOrderItem
{
public string Type1Prop {get;set;}
}
public class OrderItemType2: CreateOrderItem
{
public string Type2Prop {get;set;}
}
Using NSwag (NSwag.AspNetCore) according to the documentation, I expected this to be enough so that documentation indicated / contained the order item types? But no...
Have i completely missed the point of what NSwag requires? I have the OrderItemType property. Do i need to get a discriminator involved? Where is this documented?
TIA