ASP.NET Core [Require] non-nullable types
问题 Here, the question was posed how to validate non-nullable required types. The provided solution to make the field nullable like the following is not desirable in my case. [Required] public int? Data { get; set; } How can you change the behavior to instead make the following fail validation in the cases where the field is omitted from the request. [Required] public int Data { get; set; } I have tried a custom validator, but these do not have information about the raw value and only see the