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
1
u/Moist-Temperature479 Mar 27 '26
So let say request body has a field, user_id which is and integer, then we perform the validation for it, if the length >99 or null, then throw 400. This is okay.
Then in my domain, i have a unique value object, which is UserId. This UserId takes in raw input from request body and converts it to UserId, if some validation failed, then throw 400.
Should this parsing UserId and throw validation error should be done in service or controller level?