요약
중첩 객체에 Validation을 사용하기 위해서는 @Valid 애노테이션을 파리미터 또는 Constructor에 붙여줘야 체인 형식으로 유효성 검증이 가능하다.
상황
중첩 객체안에 Validation 이 적용이 안되는 상황을 맞이했다.

결과적으로 400상태코드를 예상했지만 200을 반환한다.

해결
중첩 객체필드에 @Valid 애노테이션을 붙여야 해당 객체를 validation 할 수 있었다.

원래는 Controller 매개변수 앞에만 붙이면 타고타고 들어가서 Validation 할 객체라고 인식할 줄 알았다.
애노테이션을 다시 보니, CONSTRUCTOR 를 보고 해당 객체를 인식할 수 있는 무언가가 필요하다고 힌트를 얻을 수 있었다.
/** * Marks a property, method parameter or method return type for validation cascading. * <p> * Constraints defined on the object and its properties are be validated when the * property, method parameter or method return type is validated. * <p> * This behavior is applied recursively. * * @author Emmanuel Bernard * @author Hardy Ferentschik */ @Target({ METHOD, FIELD, CONSTRUCTOR, PARAMETER, TYPE_USE }) @Retention(RUNTIME) @Documented public @interface Valid { }