Skip to content

Commit 110fc05

Browse files
authored
fix RedisJSON#947 step value can only positive none zero (RedisJSON#952) (RedisJSON#966)
(cherry picked from commit a2fdfb4)
1 parent 33f55d4 commit 110fc05

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/jsonpath/grammer.pest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ string = _{("'" ~ (string_value) ~ "'") | ("\"" ~ (string_value) ~ "\"") | ("\""
88

99
string_list = {string ~ ("," ~ string)*}
1010

11-
pos_number = @{ASCII_NONZERO_DIGIT ~ ASCII_DIGIT* | ASCII_DIGIT}
11+
pos_number = @{ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*}
1212
number = @{"-"? ~ ASCII_NONZERO_DIGIT ~ ASCII_DIGIT* | "-"? ~ ASCII_DIGIT}
1313

1414
decimal = @{number ~ ("." ~ ASCII_DIGIT+)?}

src/jsonpath/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ mod json_path_tests {
206206
verify_json!(path:"$.foo.[\"boo\"][-3,-1]", json:{"foo":{"boo":[1,2,3]}}, results:[1,3]);
207207
}
208208

209+
#[test]
210+
fn basic_full_range() {
211+
setup();
212+
verify_json!(path:"$.foo.[\"boo\"][0:2:1]", json:{"foo":{"boo":[1,2,3]}}, results:[1,2]);
213+
verify_json!(path:"$.foo.[\"boo\"][0:3:2]", json:{"foo":{"boo":[1,2,3]}}, results:[1,3]);
214+
assert!(crate::jsonpath::compile("$.foo.[\"boo\"][0:3:0]").is_err());
215+
}
216+
209217
#[test]
210218
fn basic_bracket_notation_with_range() {
211219
setup();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy