File tree Expand file tree Collapse file tree
main/java/org/opensearch/dataprepper/model/event
test/java/org/opensearch/dataprepper/model/event Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 ));
Original file line number Diff line number Diff 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" ,
You can’t perform that action at this time.
0 commit comments