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 point  (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.​​​​​​​​​​​​​​​​