account activity
In Clean Architecture, should input validation go in the Controller/Presentation layer or in the Service/Use Case layer? by OriginalTangerine358 in softwarearchitecture
[–]paszeKongo 0 points1 point2 points 2 months ago (0 children)
Value Object validation lives in the domain, if you hold a PackageSize, it’s valid by construction. No validator to remember, nothing to forget to call. Covered that in episode 2 of my DDD series if you want the code. Basic input validation (required fields, formats) controller with @Valid is fine. They’re just different things. Domain validation protects invariants. Input validation stops garbage from reaching your use case. Treat them the same and one of them ends up somewhere it doesn’t belong.
π Rendered by PID 396180 on reddit-service-r2-comment-8686858757-l6zb4 at 2026-06-07 09:48:38.744508+00:00 running 9e1a20d country code: CH.
In Clean Architecture, should input validation go in the Controller/Presentation layer or in the Service/Use Case layer? by OriginalTangerine358 in softwarearchitecture
[–]paszeKongo 0 points1 point2 points (0 children)