Minimal API validation should support validation attributes on primary constructor parameters
Open
area-minimal
feature-validation
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
The implementation currently doesn't support scenarios like the following:
```
public class SubType(string? requiredProperty, [StringLength(10)] string? stringWithLength)
{
[Required]
public string RequiredProperty { get; } = requiredProperty;
public string? StringWithLength { get; } = stringWithLength;
}
```
Where attributes are applied on parameters for a primary constructor for a class. We need to update the constructor discovery logic to be less greedy when discovering primary constructors for non-record types.
Contributor guide
Assessment
This issue has not been assessed yet.