Best place for input validation?
I guess no validation logic is provided in this sample. Where is the best place to write validation logic in clean architecture? in Views, ViewModels, Use Cases, Models or Data Entities? Or maybe each layer must have its own validators?
it depends what and where you want to validate, if you want to validate on the views itself or if you want to validate before api call
In my case, I usually just handle validation logic in the repo and if validation fails I call a Left(Failure) and then in the view(fragment) I handle the failure
I believe it should be a result type of a sealed class of a "Result class per UseCase" approach.
But input validation should occur in ViewModel.
Depend on requirement. We can set validation on View, ViewModel or Model part also. As per my suggestion its better to set validation on View part so it will show validation on runtime.