I had a property LineItems
which was of type List<LineItem>
, it was [Required]
. We realized that it was possible to send an empty array via JSON ("lineItems": []
) which was not what we wanted to achieve with the [Required]
attribute.
I've thought about a solution, maybe a custom filter but then I found out that it is possible to use [MinLength(1)]
. Unfortunately only in the case of an array (LineItem[]
).
My Question now is: Are there any arguments to favor one type over the other regarding the interface?