Merge branch 'master' into release-3.4
This commit is contained in:
commit
491d05b4a2
@ -53,8 +53,13 @@ public class ConstraintValidator {
|
|||||||
public static List<String> getConstraintsViolations(Object data) {
|
public static List<String> getConstraintsViolations(Object data) {
|
||||||
return fieldsValidator.validate(data).stream()
|
return fieldsValidator.validate(data).stream()
|
||||||
.map(constraintViolation -> {
|
.map(constraintViolation -> {
|
||||||
|
String property;
|
||||||
|
if (constraintViolation.getConstraintDescriptor().getAttributes().containsKey("fieldName")) {
|
||||||
|
property = constraintViolation.getConstraintDescriptor().getAttributes().get("fieldName").toString();
|
||||||
|
} else {
|
||||||
Path propertyPath = constraintViolation.getPropertyPath();
|
Path propertyPath = constraintViolation.getPropertyPath();
|
||||||
String property = Iterators.getLast(propertyPath.iterator()).toString();
|
property = Iterators.getLast(propertyPath.iterator()).toString();
|
||||||
|
}
|
||||||
return property + " " + constraintViolation.getMessage();
|
return property + " " + constraintViolation.getMessage();
|
||||||
})
|
})
|
||||||
.distinct()
|
.distinct()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user