Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class JacksonEventKey implements EventKey {
private JsonPointer jsonPointer;
private final Set<EventKeyFactory.EventAction> supportedActions;
private static final Pattern INVALID_KEY_CHARS_PATTERN =
Pattern.compile("[^A-Za-z0-9._~@/\\[\\]-]");
Pattern.compile("[^A-Za-z0-9._~@/\\[\\]\\(\\)-]");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we looking to enforce a pair to be present? or just one open or closed parentheses should still be allowed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since OpenSearch allows the Key Name to have only one parentheses, so did not have the pair check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could help to add this case to the testing scenarios


/**
* Constructor for the JacksonEventKey which should only be used by implementation
Expand Down Expand Up @@ -182,6 +182,8 @@ private static boolean isValidKey(final String key) {
|| c == ']'
|| c == ' '
|| c == '$'
|| c == '('
|| c == ')'
)) {

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ void constructor_throws_with_empty_string_for_unsupported_actions(final EventKey

@ParameterizedTest
@ValueSource(strings = {
"inv(alid",
"getMetadata(\"test_key\")"
})
void constructor_throws_with_invalid_key(final String key) {
Expand Down Expand Up @@ -152,7 +151,6 @@ void supports_returns_true_if_any_supports(final List<EventKeyFactory.EventActio
@CsvSource(value = {
"test_key, true",
"/test_key, true",
"inv(alid, false",
"getMetadata(\"test_key\"), false",
"key.with.dot, true",
"key-with-hyphen, true",
Expand All @@ -164,7 +162,8 @@ void supports_returns_true_if_any_supports(final List<EventKeyFactory.EventActio
" key_with_space_prefix, true",
"key_with_space_suffix , true",
"$key_with_dollar_prefix, true",
"key_with_dollar_suffix$, true"
"key_with_dollar_suffix$, true",
"key(withparentheses), true"
})
void isValidEventKey_returns_expected_result(final String key, final boolean isValid) {
assertThat(JacksonEventKey.isValidEventKey(key), equalTo(isValid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,6 @@ void testJsonStringBuilderWithExcludeKeys() {
@ParameterizedTest
@CsvSource(value = {"test_key, true",
"/test_key, true",
"inv(alid, false",
"getMetadata(\"test_key\"), false",
"key.with.dot, true",
"key-with-hyphen, true",
Expand Down
Loading