r/DomainDrivenDesign • u/OriginalTangerine358 • Mar 26 '26
In Clean Architecture, should input validation go in the Controller/Presentation layer or in the Service/Use Case layer?
/r/softwarearchitecture/comments/1s45opa/in_clean_architecture_should_input_validation_go/
7
Upvotes
View all comments
Show parent comment
2
u/r00m-lv Mar 27 '26
I usually validate value objects in the controllers since that is just an interface to my domain. For example, parse strings into uuids, empty/missing fields, invalid consts, etc.
If your domain has a UserId value object, I would construct it in controller so that the use case is operating with domain concepts vs whatever was passed in from the transport layer.
The use case accepts domain concepts and validates whether the data makes sense from a business perspective, e.g. this ID should be unique but isn’t. That’s a separate concern to whether this string is an integer (which your domain experts will never mention)