Recently I asked the following question regarding Clean Architecture with some things that were unclear to me: https://softwareengineering.stackexchange.com/questions/455836/clean-architecture-using-interfaces-or-mediator-approach/455839

I think I have a better understanding now. I'm using ASP.NET Core for development and I have an API layer with endpoints calling logic in the Application layer using injected interfaces.

I wish to use [FluentValidation][1] for writing my validation logic and I'm wondering what is the place for doing validation on data.

 1. One approach would be to have validation written on the Presentation layer, and have the validation done in the called endpoint. If all is valid, call the Application layer with the received data.
 2. Another approach would be to have the validation in the called method in the Application layer - the thought is that the API is the interaction with the user and the Application is in-charge of validating the data it had received is valid. Also If for some reason there would be any additional front-facing layers (parallel to the API layer) there wouldn't need to be validators introduced to it since the Application code is the one doing the validation, while the presentation is just accepting the data and passing it forward to the application. But this approach also add a bit of complexity since the response from the Application should return exactly what is invalid in the data to the presentation layer so that the presentation layer could notify the caller.
3. A final approach is to have it in both places - which seems a bit redundant to me.

I've seen a lot of developers that put it as part of a pipeline - when using Mediator approach  - which is not my case - maybe a con in favor of Mediator approach?

What is the "correct" place to place the validation?


  [1]: https://docs.fluentvalidation.net/en/latest/