You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all validations errors are handled by throwing exceptions, which is arguably not an elegant or clean solution (nor is it efficient from a request handling performance perspective). And handling validation via exceptions is a frequent matter of contention in the developer community. So it would be great to showcase a different solution.
The solution has to still keep API concerns out of the application layer, so setting or returning any sort of response is out of the question.
The best candidate is most likely implementing a response model that is used universally by all request handlers, and it would contain – besides the return value, if any – whether the operation was successful, and if not, the validation errors that has occurred.
The MediatR IPipelineBehavior responsible for request validation also should adapt to this mechanism.
The text was updated successfully, but these errors were encountered:
Currently all validations errors are handled by throwing exceptions, which is arguably not an elegant or clean solution (nor is it efficient from a request handling performance perspective). And handling validation via exceptions is a frequent matter of contention in the developer community. So it would be great to showcase a different solution.
The solution has to still keep API concerns out of the application layer, so setting or returning any sort of response is out of the question.
The best candidate is most likely implementing a response model that is used universally by all request handlers, and it would contain – besides the return value, if any – whether the operation was successful, and if not, the validation errors that has occurred.
The MediatR
IPipelineBehavior
responsible for request validation also should adapt to this mechanism.The text was updated successfully, but these errors were encountered: