From cb00f5cfe9450f586f5774bf0fb9becb4383261d Mon Sep 17 00:00:00 2001 From: Trevor Hilton Date: Thu, 24 Aug 2023 22:16:48 -0400 Subject: [PATCH 1/4] Add a line briefly describing descendant operator in docs --- serde_json_path/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/serde_json_path/src/lib.rs b/serde_json_path/src/lib.rs index a3268c1..093d115 100644 --- a/serde_json_path/src/lib.rs +++ b/serde_json_path/src/lib.rs @@ -172,7 +172,9 @@ //! # } //! ``` //! -//! #### Recursive descent (`..`) +//! #### Descendant Operator (`..`) +//! +//! JSONPath query segments following a descendant operator (`..`) will visit the input node and each of its [descendants][ietf-descendants-def]. //! //! ```rust //! # use serde_json::json; @@ -193,8 +195,9 @@ //! # } //! ``` //! -//! [jp_spec]: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-14.html -//! [jp_selectors]: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-14.html#name-selectors-2 +//! [jp_spec]: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-17.html +//! [jp_selectors]: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-17.html#name-selectors-2 +//! [ietf-descendants-def]: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-17.html#section-1.1-6.28.1 #![warn( clippy::all, From cf7ac790faf6fcbfafcf265f521bd0ef53063d94 Mon Sep 17 00:00:00 2001 From: Trevor Hilton Date: Thu, 24 Aug 2023 22:19:45 -0400 Subject: [PATCH 2/4] update changelog --- serde_json_path/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serde_json_path/CHANGELOG.md b/serde_json_path/CHANGELOG.md index 57bc0f2..32136ac 100644 --- a/serde_json_path/CHANGELOG.md +++ b/serde_json_path/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased +- **documentation**: Add line describing Descendant Operator ([#53]) + +[#53]: https://github.com/hiltontj/serde_json_path/pull/53 + # 0.6.2 (13 July 2023) * **fixed**: Fixed an issue in the evaluation of `SingularQuery`s that was producing false positive query results when relative singular queries, e.g., `@.bar`, were being used as comparables in a filter, e.g., `$.foo[?(@.bar == 'baz')]` ([#50]) From 78e84f7e271c7c2a27a8e3a9e783943bf6344cd0 Mon Sep 17 00:00:00 2001 From: Trevor Hilton Date: Thu, 24 Aug 2023 22:21:46 -0400 Subject: [PATCH 3/4] clippy --- serde_json_path/src/parser/mod.rs | 2 +- serde_json_path/src/parser/primitive/string.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serde_json_path/src/parser/mod.rs b/serde_json_path/src/parser/mod.rs index fd5502d..cca0227 100644 --- a/serde_json_path/src/parser/mod.rs +++ b/serde_json_path/src/parser/mod.rs @@ -151,7 +151,7 @@ fn parse_current_query(input: &str) -> PResult { } #[cfg_attr(feature = "trace", tracing::instrument(level = "trace", parent = None, ret, err))] -pub(self) fn parse_query(input: &str) -> PResult { + fn parse_query(input: &str) -> PResult { alt((parse_root_query, parse_current_query))(input) } diff --git a/serde_json_path/src/parser/primitive/string.rs b/serde_json_path/src/parser/primitive/string.rs index 15cbdbf..bf7f61d 100644 --- a/serde_json_path/src/parser/primitive/string.rs +++ b/serde_json_path/src/parser/primitive/string.rs @@ -256,7 +256,7 @@ mod tests { Ok(("", String::from("te\"st"))) ); assert_eq!( - parse_string_literal(r#"'te\'st'"#), + parse_string_literal(r"'te\'st'"), Ok(("", String::from("te'st"))) ); } From d3ec68554706f0e3bafb15c0ff16b2e8bee4725d Mon Sep 17 00:00:00 2001 From: Trevor Hilton Date: Thu, 24 Aug 2023 22:25:17 -0400 Subject: [PATCH 4/4] fmt --- serde_json_path/src/parser/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serde_json_path/src/parser/mod.rs b/serde_json_path/src/parser/mod.rs index cca0227..acc4ec6 100644 --- a/serde_json_path/src/parser/mod.rs +++ b/serde_json_path/src/parser/mod.rs @@ -151,7 +151,7 @@ fn parse_current_query(input: &str) -> PResult { } #[cfg_attr(feature = "trace", tracing::instrument(level = "trace", parent = None, ret, err))] - fn parse_query(input: &str) -> PResult { +fn parse_query(input: &str) -> PResult { alt((parse_root_query, parse_current_query))(input) }