Input Validation for Monitor Fields#771
Open
vikhy-aws wants to merge 3 commits intoopensearch-project:mainfrom
Open
Input Validation for Monitor Fields#771vikhy-aws wants to merge 3 commits intoopensearch-project:mainfrom
vikhy-aws wants to merge 3 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: vikhy-aws <191836418+vikhy-aws@users.noreply.github.com>
…elds Signed-off-by: vikhy-aws <191836418+vikhy-aws@users.noreply.github.com>
Signed-off-by: vikhy-aws <191836418+vikhy-aws@users.noreply.github.com>
AWSHurneyt
reviewed
Feb 3, 2025
| } | ||
|
|
||
| fun isValidName(name: String): Boolean { | ||
| fun isValidQueryName(name: String): Boolean { |
Collaborator
There was a problem hiding this comment.
Could you add a short doc comment that explains this function validates the doc level monitor DocLevelQuery name specifically? We use the term "query" in many places, so a quick comment can help prevent confusion.
https://github.com/opensearch-project/common-utils/blob/main/src/main/kotlin/org/opensearch/commons/alerting/model/DocLevelQuery.kt#L16
| import org.junit.jupiter.api.Assertions.assertTrue | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| class ValidationHelpers { |
Collaborator
There was a problem hiding this comment.
Nitpick: Could you rename the test suite and it file to something like ValiationHelpersTests? That will follow the naming pattern we've used for other unit test suites.
https://github.com/opensearch-project/common-utils/blob/main/src/test/kotlin/org/opensearch/commons/alerting/MonitorTests.kt
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a validation helper function to validate the name fields in a monitor. This helper function is used in Alerting to validate the monitor name and trigger name fields.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.