currently I'm struggling with a FieldDescriptor which seem not to "see" all validation constraints. Following scenario:
I have an Dto similar to:
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExampleDto {
@NotNull
@Valid
private GeoCoordinates coordinate;
@Min(value = 0)
@Max(value = 100)
private BigDecimal workingProperty = BigDecimal.valueOf(0);
//...
And a class GeoCoordinates like this:
@Getter
@NoArgsConstructor
public class GeoCoordinates {
@NotNull
@Max(value = 180)
private Double latitude;
//...
The constraints on the "workingProperty" are properly found on the FieldDescriptor:
The opposite is happening on the FieldDescriptor of the coordinate:
Following the documentation https://docs.spring.io/spring-restdocs/docs/current/reference/html5/#documenting-your-api-constraints-finding I don't see the issue why the constraint on one field is found and not on the other. Especially as the Validator is validating everything correctly.
After some research I found the reason for the issue in a custom ValidatorConstraintResolver. It was only investigating the top level constraints and i had to dive deeper by using reflections.