Search code examples
c#.net-6.0fluentvalidationasp.net-core-6.0

.Net core 6 Web api Fluent Validation - Calling addfluentvalidation() is deprecated and Response errors is missing


I'm building a .net core 6 web API server. I tried using Fluent Validation but I'm getting a warning that Calling addfluentvalidation() is deprecated.

enter image description here

Besides the warning, I was happy with the final result (an example of a 400 response)

enter image description here

So I tried looking for a better solution for using Fluent Validation without a deprecation warning.

I found this solution:

enter image description here

Which works but I'm now not satisfied with the response (The errors column now is missing)

Does anyone know why I'm not getting the errors column anymore? I have tried looking it online but no luck whatsoever.

enter image description here


Solution

  • You can add the following for auto validation.

    services.AddFluentValidationAutoValidation();