Skip to content

Commit 7b37b5a

Browse files
Merge branch 'release/1.6.0' into master/1.x
2 parents f73c3e6 + d9b8648 commit 7b37b5a

10 files changed

Lines changed: 52 additions & 33 deletions

File tree

.github/workflows/deploy-snapshot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v5.0.0
1212
- name: Set up JDK 1.8
13-
uses: actions/setup-java@v4.7.1
13+
uses: actions/setup-java@v5.0.0
1414
with:
1515
java-version: '8'
1616
distribution: 'temurin'

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fetch-depth: 0
1919

2020
- name: Set up JDK 1.8
21-
uses: actions/setup-java@v4.7.1
21+
uses: actions/setup-java@v5.0.0
2222
with:
2323
java-version: '8'
2424
distribution: 'temurin'

.github/workflows/test-pull-requests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Set up JDK 1.8
2525
if: matrix.java-env.name == 'JDK 1.8'
26-
uses: actions/setup-java@v4.7.1
26+
uses: actions/setup-java@v5.0.0
2727
with:
2828
java-version: ${{ matrix.java-env.java-version }}
2929
distribution: ${{ matrix.java-env.distribution }}

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Usage
1212

1313
First, you need Java 8 or later.
1414

15-
If you use Maven, add the following snippet to the `<dependencies>` section of your POM. For instructions for other build tools (Gradle, etc.), visit [jackson-jq](https://search.maven.org/artifact/net.thisptr/jackson-jq/1.5.0/jar) on search.maven.org.
15+
If you use Maven, add the following snippet to the `<dependencies>` section of your POM. For instructions for other build tools (Gradle, etc.), visit [jackson-jq](https://search.maven.org/artifact/net.thisptr/jackson-jq/1.6.0/jar) on search.maven.org.
1616

1717
```xml
1818
<dependency>
1919
<groupId>net.thisptr</groupId>
2020
<artifactId>jackson-jq</artifactId>
21-
<version>1.5.0</version>
21+
<version>1.6.0</version>
2222
</dependency>
2323
```
2424

@@ -32,29 +32,29 @@ To test a query quickly, we provide jackson-jq CLI.
3232
*Please note that jackson-jq is a Java library and the CLI is provided solely for debugging/testing purpose (and not for production). The command-line options might change without notice.*
3333

3434
```sh
35-
$ curl -LO https://repo1.maven.org/maven2/net/thisptr/jackson-jq-cli/1.5.0/jackson-jq-cli-1.5.0.jar
35+
$ curl -LO https://repo1.maven.org/maven2/net/thisptr/jackson-jq-cli/1.6.0/jackson-jq-cli-1.6.0.jar
3636

37-
$ java -jar jackson-jq-cli-1.5.0.jar --help
37+
$ java -jar jackson-jq-cli-1.6.0.jar --help
3838
usage: jackson-jq [OPTIONS...] QUERY
3939
-c,--compact compact instead of pretty-printed output
4040
-h,--help print this message
4141
--jq <arg> specify jq version
4242
-n,--null-input use `null` as the single input value
4343
-r,--raw output raw strings, not JSON texts
4444

45-
$ java -jar jackson-jq-cli-1.5.0.jar '.foo'
45+
$ java -jar jackson-jq-cli-1.6.0.jar '.foo'
4646
{"foo": 42}
4747
42
4848
```
4949

5050
To test a query with a specific jq version,
5151

5252
```sh
53-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.5 'join("-")'
53+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.5 'join("-")'
5454
["1", 2]
5555
jq: error: string ("-") and number (2) cannot be added
5656

57-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.6 'join("-")' # jq-1.6 can join any values, not only strings
57+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.6 'join("-")' # jq-1.6 can join any values, not only strings
5858
["1", 2]
5959
"1-2"
6060
```
@@ -236,9 +236,9 @@ $ jq -n '1 + 3 as $a | ($a * 2)' # interpreted as 1 + (3 as $a | ($a * 2))
236236
whereas jackson-jq consistently interprets them as `(1 + 3)` whether `as $a` is used or not:
237237

238238
```console
239-
$ java -jar jackson-jq-cli-1.5.0.jar -n '1 + 3 | (. * 2)' # interpreted as (1 + 3) | (. * 2)
239+
$ java -jar jackson-jq-cli-1.6.0.jar -n '1 + 3 | (. * 2)' # interpreted as (1 + 3) | (. * 2)
240240
8
241-
$ java -jar jackson-jq-cli-1.5.0.jar -n '1 + 3 as $a | ($a * 2)' # interpreted as (1 + 3) as $a | ($a * 2)
241+
$ java -jar jackson-jq-cli-1.6.0.jar -n '1 + 3 as $a | ($a * 2)' # interpreted as (1 + 3) as $a | ($a * 2)
242242
8
243243
```
244244

@@ -247,7 +247,7 @@ $ java -jar jackson-jq-cli-1.5.0.jar -n '1 + 3 as $a | ($a * 2)' # interpreted a
247247
```console
248248
$ jq -n '1 + 3 as $a | ($a * 2)' # interpreted as 1 + (3 as $a | ($a * 2))
249249
7
250-
$ java -jar jackson-jq-cli-1.5.0.jar -n '1 + 3 as $a | ($a * 2)' # interpreted as (1 + 3) as $a | ($a * 2)
250+
$ java -jar jackson-jq-cli-1.6.0.jar -n '1 + 3 as $a | ($a * 2)' # interpreted as (1 + 3) as $a | ($a * 2)
251251
8
252252
```
253253

@@ -274,7 +274,7 @@ If the function with the same is defined more than once at the same scope, jacks
274274
```console
275275
$ jq -n 'def f: 1; def g: f; def f: 2; g'
276276
1
277-
$ java -jar jackson-jq-cli-1.5.0.jar -n 'def f: 1; def g: f; def f: 2; g'
277+
$ java -jar jackson-jq-cli-1.6.0.jar -n 'def f: 1; def g: f; def f: 2; g'
278278
2
279279
```
280280

@@ -283,7 +283,7 @@ $ java -jar jackson-jq-cli-1.5.0.jar -n 'def f: 1; def g: f; def f: 2; g'
283283
Avoid using the duplicate function name.
284284

285285
```console
286-
$ java -jar jackson-jq-cli-1.5.0.jar -n 'def f1: 1; def g: f1; def f2: 2; g'
286+
$ java -jar jackson-jq-cli-1.6.0.jar -n 'def f1: 1; def g: f1; def f2: 2; g'
287287
1
288288
```
289289

@@ -353,7 +353,7 @@ jq: error: Division by zero? at <top-level>, line 1:
353353
jq: 1 compile error
354354
$ jq '. / 0' <<< 0
355355
jq: error (at <stdin>:1): number (0) and number (0) cannot be divided because the divisor is zero
356-
$ java -jar jackson-jq-cli-1.5.0.jar -n '0 / 0'
356+
$ java -jar jackson-jq-cli-1.6.0.jar -n '0 / 0'
357357
jq: error: number (0) and number (0) cannot be divided because the divisor is zero
358358
```
359359

@@ -386,9 +386,9 @@ $ jq-1.2 -n '[1,2,3] | ((.[] | select(. > 1)) |= empty)'
386386
2,
387387
3
388388
]
389-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.6 -n '[1,2,3] | ((.[] | select(. > 1)) |= empty)'
389+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.6 -n '[1,2,3] | ((.[] | select(. > 1)) |= empty)'
390390
jq: error: `|= empty` is undefined. See https://github.com/stedolan/jq/issues/897
391-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.5 -n '[1,2,3] | ((.[] | select(. > 1)) |= empty)'
391+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.5 -n '[1,2,3] | ((.[] | select(. > 1)) |= empty)'
392392
jq: error: `|= empty` is undefined. See https://github.com/stedolan/jq/issues/897
393393
```
394394

@@ -397,9 +397,9 @@ jq: error: `|= empty` is undefined. See https://github.com/stedolan/jq/issues/89
397397
You can use `_modify/2` if you really want to the original behavior.
398398

399399
```console
400-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.6 -n '[1,2,3] | _modify((.[] | select(. > 1)); empty)'
400+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.6 -n '[1,2,3] | _modify((.[] | select(. > 1)); empty)'
401401
[ 1, 3 ]
402-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.5 -n '[1,2,3] | _modify((.[] | select(. > 1)); empty)'
402+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.5 -n '[1,2,3] | _modify((.[] | select(. > 1)); empty)'
403403
null
404404
```
405405

@@ -419,7 +419,7 @@ jq 1.5
419419
```console
420420
$ jq-1.5 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
421421
["foo"]
422-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.5 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
422+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.5 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
423423
jq: error: Invalid path expression with result 1
424424
```
425425

@@ -428,7 +428,7 @@ jq 1.6
428428
```console
429429
$ jq-1.6 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
430430
jq: error (at <stdin>:1): Invalid path expression with result 1
431-
$ java -jar jackson-jq-cli-1.5.0.jar --jq 1.6 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
431+
$ java -jar jackson-jq-cli-1.6.0.jar --jq 1.6 -c 'path(.foo as $a | $a)' <<< '{"foo": 1}'
432432
jq: error: Invalid path expression with result 1
433433
```
434434

@@ -452,7 +452,7 @@ $ jq -n 'label $a | label $b | try (break $b) catch .'
452452
{
453453
"__jq": 1
454454
}
455-
$ java -jar jackson-jq-cli-1.5.0.jar -n 'label $a | label $b | try (break $b) catch .'
455+
$ java -jar jackson-jq-cli-1.6.0.jar -n 'label $a | label $b | try (break $b) catch .'
456456
{
457457
"__jq" : 0
458458
}
@@ -482,7 +482,7 @@ $ jq-1.6 -n '"x" | indices("")' # stuck in infinite loop
482482
^C
483483
$ jq-1.6-83-gb52fc10 -n '"x" | indices("")'
484484
[]
485-
$ java -jar jackson-jq-cli-1.5.0.jar -n '"x" | indices("")'
485+
$ java -jar jackson-jq-cli-1.6.0.jar -n '"x" | indices("")'
486486
[ ]
487487
```
488488

@@ -499,7 +499,7 @@ To use this module, you need to add the following Maven dependency and set `Buil
499499
<dependency>
500500
<groupId>net.thisptr</groupId>
501501
<artifactId>jackson-jq-extra</artifactId>
502-
<version>1.5.0</version>
502+
<version>1.6.0</version>
503503
</dependency>
504504
```
505505

jackson-jq-cli/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<parent>
99
<groupId>net.thisptr</groupId>
1010
<artifactId>jackson-jq-parent</artifactId>
11-
<version>1.5.0</version>
11+
<version>1.6.0</version>
1212
</parent>
1313

1414
<dependencies>
1515
<dependency>
1616
<groupId>net.thisptr</groupId>
1717
<artifactId>jackson-jq-extra</artifactId>
18-
<version>1.5.0</version>
18+
<version>1.6.0</version>
1919
</dependency>
2020
<dependency>
2121
<groupId>commons-cli</groupId>

jackson-jq-extra/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<parent>
99
<groupId>net.thisptr</groupId>
1010
<artifactId>jackson-jq-parent</artifactId>
11-
<version>1.5.0</version>
11+
<version>1.6.0</version>
1212
</parent>
1313

1414
<dependencies>
1515
<dependency>
1616
<groupId>net.thisptr</groupId>
1717
<artifactId>jackson-jq</artifactId>
18-
<version>1.5.0</version>
18+
<version>1.6.0</version>
1919
</dependency>
2020
</dependencies>
2121

jackson-jq/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>net.thisptr</groupId>
1010
<artifactId>jackson-jq-parent</artifactId>
11-
<version>1.5.0</version>
11+
<version>1.6.0</version>
1212
</parent>
1313

1414
<dependencies>

jackson-jq/src/main/java/net/thisptr/jackson/jq/internal/functions/MathFunction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ protected double f(double f) {
8989
}
9090
}
9191

92+
@AutoService(Function.class)
93+
@BuiltinFunction("ceil/0")
94+
public static class CeilFunction extends MathFunction {
95+
@Override
96+
protected double f(double f) {
97+
return Math.ceil(f);
98+
}
99+
}
100+
92101
@AutoService(Function.class)
93102
@BuiltinFunction(value = "round/0", version = "[1.6, )")
94103
public static class RoundFunction extends MathFunction {

jackson-jq/src/test/resources/tests/functions/math-functions.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@
5656
- q: '[0, 2.2250738585072011e-308, 2.2250738585072014e-308, 1, nan, infinite | ., -. | normals]'
5757
out:
5858
- [2.2250738585072014e-308, -2.2250738585072014e-308, 1, -1]
59+
60+
- q: 'map(floor)'
61+
in: [2.1, 2.7, -2.1, -2.7, 0, 42]
62+
out:
63+
- [2, 2, -3, -3, 0, 42]
64+
65+
- q: 'map(ceil)'
66+
in: [2.1, 2.7, -2.1, -2.7, 0, 42]
67+
out:
68+
- [3, 3, -2, -2, 0, 42]

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>net.thisptr</groupId>
55
<artifactId>jackson-jq-parent</artifactId>
66
<packaging>pom</packaging>
7-
<version>1.5.0</version>
7+
<version>1.6.0</version>
88
<name>${project.groupId}:${project.artifactId}</name>
99
<description>jq for Jackson JSON Processor</description>
1010
<url>https://github.com/eiiches/jackson-jq</url>
@@ -28,7 +28,7 @@
2828
<connection>scm:git:git@github.com:eiiches/jackson-jq.git</connection>
2929
<developerConnection>scm:git:git@github.com:eiiches/jackson-jq.git</developerConnection>
3030
<url>git@github.com:eiiches/jackson-jq.git</url>
31-
<tag>1.5.0</tag>
31+
<tag>1.6.0</tag>
3232
</scm>
3333

3434
<modules>
@@ -205,7 +205,7 @@
205205
<plugin>
206206
<groupId>org.apache.maven.plugins</groupId>
207207
<artifactId>maven-javadoc-plugin</artifactId>
208-
<version>3.11.2</version>
208+
<version>3.11.3</version>
209209
</plugin>
210210
<plugin>
211211
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)