Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
removed root bean path from validation path
Browse files Browse the repository at this point in the history
  • Loading branch information
falu2010-netflix committed Dec 31, 2018
1 parent 11aae88 commit 6243530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ private static ErrorResponse constraintViolationExceptionToErrorResponse(Constra
}

private static String getViolationPath(final ConstraintViolation violation) {
final String rootBeanName = violation.getRootBean().getClass().getSimpleName();
final String propertyPath = violation.getPropertyPath().toString();

return rootBeanName + (!"".equals(propertyPath) ? '.' + propertyPath : "");
return !"".equals(propertyPath) ? propertyPath : "";
}

private static String getViolationInvalidValue(final Object invalidValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ public void testEmptyCreateWorkflowDef() {
assertEquals(400, e.getStatus());
assertEquals("Validation failed, check below errors for detail.", e.getMessage());
assertFalse(e.isRetryable());
List<ValidationError> errors = e.getValidationErrors();
List<String> errorMessages = errors.stream()
.map(v -> v.getMessage())
.collect(Collectors.toList());
assertTrue(errorMessages.contains("WorkflowDef name cannot be null or empty"));
assertTrue(errorMessages.contains("WorkflowTask list cannot be empty"));
throw e;
}
}
Expand Down

0 comments on commit 6243530

Please sign in to comment.