C
C#2y ago
zulerf

❔ FluentValidation Custom Client Response?

I have a FluentValidation implementation for my .net core API, currently when a validation exception is thrown, I get a 400 error code, was wondering if I can change this to respond with a 422 error code instead. The .WithErrorCode attributes will not work as these are localised, I have read many solutions which are way to convoluted for the scope of this project. Is there a simple way of doing it?
3 Replies
zulerf
zulerfOP2y ago
Should note I am using AutoValidation, so initializing the Validator in the controller and returning an ActionResult from there is not an option unfortunately
Anton
Anton2y ago
Yeah there is a global event for this I think
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server