diff --git a/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt b/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt index 096938b8..811dcd9e 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt @@ -20,7 +20,9 @@ class DeleteCommentRequest : ActionRequest { override fun validate(): ActionRequestValidationException? { if (commentId.isBlank()) { - return ActionRequestValidationException() + val exception = ActionRequestValidationException() + exception.addValidationError("comment id must not be blank") + return exception } return null } diff --git a/src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt b/src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt index ab62599d..6b66cb64 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt @@ -54,7 +54,9 @@ class IndexCommentRequest : ActionRequest { if (method == RestRequest.Method.POST && entityId.isBlank() || method == RestRequest.Method.PUT && commentId.isBlank() ) { - return ActionRequestValidationException() + val exception = ActionRequestValidationException() + exception.addValidationError("id must not be blank") + return exception } return null }