-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
First of all thank you very much for a great library!
Here is a case:
- Create an ASP.NET Core project and add
RuntimeNullablespackage - Create endpoint and request data class:
[Post]
public IActionResult Auth(AuthRequest request)
{
//logic
}
public record AuthRequest(string Something);- Send a request to this gateway:
{ "Something": null }- Server returned 500 error (cause
Somethingcannot be null), but had to return 400 (Bad Request). So, as you see this is kind of a bug actually.
Of course we can add [NullChecks(false)] attribute to the request class and the bug will disappear, but what if we forget to do that? Again 500? And it's actually not so convenient to add NullChecks to requests explicitly all times.
I suggest to add an ability to automatically skip null checking for requests DTO in ASP.NET Core. Let's discuss an implementation here.
PS. It's interesting that NullGuard.Fody just crashed my app at all when I sent an incorrect request like in the example, but RuntimeNullables only throws an exception and generates 500 (and also customizable). So, I fully migrated from NullGuard.Fody to RuntimeNullables. Thanks again for your work!
Metadata
Metadata
Assignees
Labels
No labels