From edf52aa6673879b4d2a6814fe1942efa37871950 Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Wed, 22 Mar 2023 00:12:08 +0100 Subject: [PATCH 1/4] Release and fix docs --- README.md | 42 ++++++++++++++++++++++-------------------- build.gradle | 4 ++-- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 0b1e72a1..db57e822 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Jayway JsonPath is a Java port of [Stefan Goessner JsonPath implementation](http News ---- +22 Mar 2023 - Released JsonPath 2.8.0 + 30 Jan 2022 - Released JsonPath 2.7.0 02 Jun 2021 - Released JsonPath 2.6.0 @@ -43,7 +45,7 @@ JsonPath is available at the Central Maven Repository. Maven users add this to y com.jayway.jsonpath json-path - 2.7.0 + 2.8.0 ``` @@ -165,25 +167,25 @@ Given the json } ``` -| JsonPath (click link to try)| Result | -| :------- | :----- | -| $.store.book[*].author| The authors of all books | -| $..author | All authors | -| $.store.* | All things, both books and bicycles | -| $.store..price | The price of everything | -| $..book[2] | The third book | -| $..book[-2] | The second to last book | -| $..book[0,1] | The first two books | -| $..book[:2] | All books from index 0 (inclusive) until index 2 (exclusive) | -| $..book[1:2] | All books from index 1 (inclusive) until index 2 (exclusive) | -| $..book[-2:] | Last two books | -| $..book[2:] | All books from index 2 (inclusive) to last | -| $..book[?(@.isbn)] | All books with an ISBN number | -| $.store.book[?(@.price < 10)] | All books in store cheaper than 10 | -| $..book[?(@.price <= $['expensive'])] | All books in store that are not "expensive" | -| $..book[?(@.author =~ /.*REES/i)] | All books matching regex (ignore case) | -| $..* | Give me every thing -| $..book.length() | The number of books | +| JsonPath | Result | +|:-------------------------------------------------------------------| :----- | +| $.store.book[*].author | The authors of all books | +| $..author | All authors | +| $.store.* | All things, both books and bicycles | +| $.store..price | The price of everything | +| $..book[2] | The third book | +| $..book[-2] | The second to last book | +| $..book[0,1] | The first two books | +| $..book[:2] | All books from index 0 (inclusive) until index 2 (exclusive) | +| $..book[1:2] | All books from index 1 (inclusive) until index 2 (exclusive) | +| $..book[-2:] | Last two books | +| $..book[2:] | All books from index 2 (inclusive) to last | +| $..book[?(@.isbn)] | All books with an ISBN number | +| $.store.book[?(@.price < 10)] | All books in store cheaper than 10 | +| $..book[?(@.price <= $['expensive'])] | All books in store that are not "expensive" | +| $..book[?(@.author =~ /.*REES/i)] | All books matching regex (ignore case) | +| $..* | Give me every thing +| $..book.length() | The number of books | Reading a Document ------------------ diff --git a/build.gradle b/build.gradle index 334ab46a..42d733ca 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,7 @@ ext { ] ] - snapshotVersion = true + snapshotVersion = false } allprojects { @@ -122,7 +122,7 @@ subprojects { pom { name = jar.baseName - description = project.description + description = 'A library to query and verify JSON' url = 'https://github.com/jayway/JsonPath' licenses { From 08830e92f462cea4b047f118dcc6ea4511f1e9e4 Mon Sep 17 00:00:00 2001 From: Oswaldo Baptista Vicente Junior <45291656+oswaldobapvicjr@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:31:46 -0300 Subject: [PATCH 2/4] Upgrade org.json:json from 20140107 to 20230227 (#907) * Upgrade org.json:json from 20140107 to 20230227 * Remove unused import --- build.gradle | 2 +- .../java/com/jayway/jsonpath/InlineFilterTest.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 334ab46a..74aa0035 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ ext { hamcrest: 'org.hamcrest:hamcrest:2.2', jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.14.2', jettison: 'org.codehaus.jettison:jettison:1.5.4', - jsonOrg: 'org.json:json:20140107', + jsonOrg: 'org.json:json:20230227', tapestryJson: 'org.apache.tapestry:tapestry-json:5.8.1', jakartaJsonP: 'jakarta.json:jakarta.json-api:2.0.1', jakartaJsonB: 'jakarta.json.bind:jakarta.json.bind-api:2.0.0', diff --git a/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java b/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java index b16fdd16..c428e3e4 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/InlineFilterTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -73,9 +74,14 @@ public class InlineFilterTest extends BaseTest { @Test public void root_context_can_be_referred_in_predicate() { - List prices = using(conf).parse(JSON_DOCUMENT).read("store.book[?(@.display-price <= $.max-price)].display-price", List.class); + List prices = using(conf).parse(JSON_DOCUMENT).read("store.book[?(@.display-price <= $.max-price)].display-price", List.class); - assertThat(prices).containsAll(asList(8.95D, 8.99D)); + assertThat(prices.stream().map(this::asDouble)).containsAll(asList(8.95D, 8.99D)); + } + + private Double asDouble(Object object) { + // For json-org implementation returns a list of big decimals + return object instanceof BigDecimal ? ((BigDecimal) object).doubleValue() : (Double) object; } @Test From 8a0d2fd594b4a1baab71132cf5ef74889b9976e5 Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Sun, 26 Mar 2023 13:45:18 +0200 Subject: [PATCH 3/4] Fix archive signing --- README.md | 2 +- build.gradle | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index db57e822..61193ae7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Jayway JsonPath is a Java port of [Stefan Goessner JsonPath implementation](http News ---- -22 Mar 2023 - Released JsonPath 2.8.0 +26 Mar 2023 - Released JsonPath 2.8.0 30 Jan 2022 - Released JsonPath 2.7.0 diff --git a/build.gradle b/build.gradle index e6f85443..3bc6c1a5 100644 --- a/build.gradle +++ b/build.gradle @@ -87,9 +87,8 @@ subprojects { } signing { - sign configurations.archives - //sign publishing.publications.mavenJava - required { !snapshotVersion && gradle.taskGraph.hasTask("publish") } // uploadArchives is replaced by publish + sign publishing.publications + required { !snapshotVersion && gradle.taskGraph.hasTask("publish") } } javadoc { From 21de6207945dfca6b49809fa9dd08c3781b7ab9d Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Sun, 26 Mar 2023 13:58:15 +0200 Subject: [PATCH 4/4] Prepare next version --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3bc6c1a5..9e805982 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,7 @@ ext { ] ] - snapshotVersion = false + snapshotVersion = true } allprojects { @@ -53,7 +53,7 @@ allprojects { ext.buildTimestamp = new Date().format('yyyy-MM-dd HH:mm:ss') group = 'com.jayway.jsonpath' - version = '2.8.0' + (snapshotVersion ? "-SNAPSHOT" : "") + version = '2.9.0' + (snapshotVersion ? "-SNAPSHOT" : "") }