Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow . and @ characters to be part of json pointer in expressions #4130

Merged
merged 1 commit into from
Feb 15, 2024
Merged
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 @@ -217,7 +217,7 @@ JsonPointerCharacters

fragment
JsonPointerCharacter
: [A-Za-z0-9_]
: [A-Za-z0-9_.@]
;

EscapedJsonPointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ private static Stream<Arguments> validExpressionArguments() {
Arguments.of("/status_code == 200", event("{}"), false),
Arguments.of("/success == /status_code", event("{\"success\": true, \"status_code\": 200}"), false),
Arguments.of("/success != /status_code", event("{\"success\": true, \"status_code\": 200}"), true),
Arguments.of("/part1@part2.part3 != 111", event("{\"success\": true, \"part1@part2.part3\":111, \"status_code\": 200}"), false),
Arguments.of("/part1.part2@part3 != 111", event("{\"success\": true, \"part1.part2@part3\":222, \"status_code\": 200}"), true),
Arguments.of("/pi == 3.14159", event("{\"pi\": 3.14159}"), true),
Arguments.of("/value == 12345.678", event("{\"value\": 12345.678}"), true),
Arguments.of("/value == 12345.678E12", event("{\"value\": 12345.678E12}"), true),
Expand Down
2 changes: 1 addition & 1 deletion docs/expression_syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Hard coded token that identifies the operation use in an _Expression_.

### Json Pointer
A Literal used to reference a value within the Event provided as context for the _Expression String_. Json Pointers are identified by a
leading `/` containing alphanumeric character or underscores, delimited by `/`. Json Pointers can use an extended character set if wrapped
leading `/` containing one of more of characters from the set `a-zA-Z0-9_.@` , delimited by `/`. Json Pointers can use an extended character set if wrapped
in double quotes (`"`) using the escape character `\`. Note, Json Pointer require `~` and `/` that should be used as part of the path and
not a delimiter to be escaped.

Expand Down
Loading