From bb7301eac208176c0b13bafd56c9d8b61510cdd8 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 17 Jul 2023 22:49:04 -0700 Subject: [PATCH] v0.6.1 (#71) --- CHANGELOG.md | 7 ++++++- lib/src/grammar/json_path.dart | 4 ++-- pubspec.yaml | 2 +- test/cases/cts | 2 +- test/cases/standard/expressions_equality.json | 21 +++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c004950..ace9775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.1] - 2023-07-17 +### Fixed +- Allow namespace in between selector segments + ## [0.6.0] - 2023-05-27 ### Changed - Bump SDK version to 3.0.0 @@ -152,6 +156,7 @@ Previously, no modification would be made and no errors/exceptions thrown. ### Added - Basic design draft +[0.6.1]: https://github.com/f3ath/jessie/compare/0.6.0...0.6.1 [0.6.0]: https://github.com/f3ath/jessie/compare/0.5.3...0.6.0 [0.5.3]: https://github.com/f3ath/jessie/compare/0.5.2...0.5.3 [0.5.2]: https://github.com/f3ath/jessie/compare/0.5.1...0.5.2 @@ -176,4 +181,4 @@ Previously, no modification would be made and no errors/exceptions thrown. [0.0.0+dev.4]: https://github.com/f3ath/jessie/compare/0.0.0+dev.3...0.0.0+dev.4 [0.0.0+dev.3]: https://github.com/f3ath/jessie/compare/0.0.0+dev.2...0.0.0+dev.3 [0.0.0+dev.2]: https://github.com/f3ath/jessie/compare/0.0.0+dev.1...0.0.0+dev.2 -[0.0.0+dev.1]: https://github.com/f3ath/jessie/compare/0.0.0+dev.0...0.0.0+dev.1 \ No newline at end of file +[0.0.0+dev.1]: https://github.com/f3ath/jessie/compare/0.0.0+dev.0...0.0.0+dev.1 diff --git a/lib/src/grammar/json_path.dart b/lib/src/grammar/json_path.dart index 6aa46ea..1041c8f 100644 --- a/lib/src/grammar/json_path.dart +++ b/lib/src/grammar/json_path.dart @@ -129,12 +129,12 @@ class JsonPathGrammarDefinition extends GrammarDefinition> { dotName, ref0(_union), ref0(_recursion), - ].toChoiceParser(); + ].toChoiceParser().trim(); Parser _singularSegment() => [ dotName, ref0(_singularUnion), - ].toChoiceParser(); + ].toChoiceParser().trim(); Parser> _segmentSequence() => _segment().star().map(sequenceSelector).map(Expression.new); diff --git a/pubspec.yaml b/pubspec.yaml index 3d67fe3..268f3c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: json_path -version: 0.6.0 +version: 0.6.1 description: Implementation of JSONPath expressions like "$.store.book[2].price". Reads and writes values in parsed JSON objects. homepage: "https://github.com/f3ath/jessie" diff --git a/test/cases/cts b/test/cases/cts index 1f50165..84d2917 160000 --- a/test/cases/cts +++ b/test/cases/cts @@ -1 +1 @@ -Subproject commit 1f501653e6e84e6830834a217abad9df405ece3b +Subproject commit 84d29173c571e72a497462d7b2ccd915bb4d85d1 diff --git a/test/cases/standard/expressions_equality.json b/test/cases/standard/expressions_equality.json index ac695d6..c4aa460 100644 --- a/test/cases/standard/expressions_equality.json +++ b/test/cases/standard/expressions_equality.json @@ -19,6 +19,13 @@ "result": [["a", "b"]], "paths": ["$[0]"], "pointers": ["/0"] + }, { + "name": "array index with odd spacing", + "selector": "$[?(@ [1] =='b')]", + "document": [["a", "b"], ["x", "y"]], + "result": [["a", "b"]], + "paths": ["$[0]"], + "pointers": ["/0"] }, { "name": "object child, single quote", "selector": "$[?(@['key'] == 'b')]", @@ -26,6 +33,13 @@ "result": [{"key": "b"}], "paths": ["$[1]"], "pointers": ["/1"] + }, { + "name": "object child, single quote, odd spacing", + "selector": "$[?(@ ['key']=='b')]", + "document": [{"key": "a"}, {"key": "b"}, {}], + "result": [{"key": "b"}], + "paths": ["$[1]"], + "pointers": ["/1"] }, { "name": "object child, double quote", "selector": "$[?(@[\"key\"] == 'b')]", @@ -47,6 +61,13 @@ "result": [{"foo": {"bar": "b"}}], "paths": ["$[1]"], "pointers": ["/1"] + }, { + "name": "object child, dot-notation, depth 2, odd spacing", + "selector": "$[?(@ \t .foo\n .bar== 'b')]", + "document": [{"foo": {"bar": "a"}}, {"foo": {"bar": "b"}}, {"foo": "b"} ,{}], + "result": [{"foo": {"bar": "b"}}], + "paths": ["$[1]"], + "pointers": ["/1"] }, { "name": "object child, dot-notation, int value", "selector": "$[?(@.id==42)].name",