Skip to content

Commit 1ac9d23

Browse files
authored
Allow Parenthsis (#6233)
Signed-off-by: Utkarsh Agarwal <126544832+Utkarsh-Aga@users.noreply.github.com>
1 parent 04def78 commit 1ac9d23

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

data-prepper-api/src/main/java/org/opensearch/dataprepper/model/event/JacksonEventKey.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class JacksonEventKey implements EventKey {
3232
private JsonPointer jsonPointer;
3333
private final Set<EventKeyFactory.EventAction> supportedActions;
3434
private static final Pattern INVALID_KEY_CHARS_PATTERN =
35-
Pattern.compile("[^A-Za-z0-9._~@/\\[\\]-]");
35+
Pattern.compile("[^A-Za-z0-9._~@/\\[\\]\\(\\)-]");
3636

3737
/**
3838
* Constructor for the JacksonEventKey which should only be used by implementation
@@ -186,6 +186,8 @@ private static boolean isValidKey(final String key) {
186186
|| c == ']'
187187
|| c == ' '
188188
|| c == '$'
189+
|| c == '('
190+
|| c == ')'
189191
)) {
190192

191193
return false;

data-prepper-api/src/test/java/org/opensearch/dataprepper/model/event/JacksonEventKeyTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ void constructor_throws_with_empty_string_for_unsupported_actions(final EventKey
5757

5858
@ParameterizedTest
5959
@ValueSource(strings = {
60-
"inv(alid",
6160
"getMetadata(\"test_key\")"
6261
})
6362
void constructor_throws_with_invalid_key(final String key) {
@@ -156,7 +155,6 @@ void supports_returns_true_if_any_supports(final List<EventKeyFactory.EventActio
156155
@CsvSource(value = {
157156
"test_key, true",
158157
"/test_key, true",
159-
"inv(alid, false",
160158
"getMetadata(\"test_key\"), false",
161159
"key.with.dot, true",
162160
"key-with-hyphen, true",
@@ -168,7 +166,8 @@ void supports_returns_true_if_any_supports(final List<EventKeyFactory.EventActio
168166
" key_with_space_prefix, true",
169167
"key_with_space_suffix , true",
170168
"$key_with_dollar_prefix, true",
171-
"key_with_dollar_suffix$, true"
169+
"key_with_dollar_suffix$, true",
170+
"key(withparentheses), true"
172171
})
173172
void isValidEventKey_returns_expected_result(final String key, final boolean isValid) {
174173
assertThat(JacksonEventKey.isValidEventKey(key), equalTo(isValid));

data-prepper-api/src/test/java/org/opensearch/dataprepper/model/event/JacksonEventTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,6 @@ void testJsonStringBuilderWithExcludeKeys() {
13491349
@ParameterizedTest
13501350
@CsvSource(value = {"test_key, true",
13511351
"/test_key, true",
1352-
"inv(alid, false",
13531352
"getMetadata(\"test_key\"), false",
13541353
"key.with.dot, true",
13551354
"key-with-hyphen, true",

0 commit comments

Comments
 (0)