Skip to content

Releases: eiiches/jackson-jq

1.0.0-preview.20191208

08 Dec 05:24
Compare
Choose a tag to compare
Pre-release

WARNING: This is a pre-release. Java API will likely to change in final 1.0.0 release.

Changes since 1.0.0-preview.20190925

Bug fixes

  • Allow escaped forward slashes (\/) in strings (#51)

0.0.12

08 Dec 05:26
Compare
Choose a tag to compare

Changes since 0.0.11

Bug fixes

  • Allow escaped forward slashes (\/) in strings (#51)

1.0.0-preview.20190925

24 Sep 17:56
Compare
Choose a tag to compare
Pre-release

WARNING: This is a pre-release. Java API will change in final 1.0.0 release.

jackson-jq 0.0.9

18 Jul 20:09
Compare
Choose a tag to compare

This release contains some incompatible changes. Please take a look at the Incompatible changes section before upgrading.

Improvements

  • join/1 is re-implemented in Java to achieve O(n) time complexity. Previously, it was implemented in jq using reduce and + operator, which incurred O(n^2) copy operations and quickly became prohibitive for large inputs.

Incompatible changes

  • It is now considered an error to include spaces between . and an identifier in field accessors (e.g. . foo). While the new behavior is in line with jq, this is a backward incompatible change for jackson-jq users. (#21, #20)

API deprecations

  • JsonQuery.apply(...) without explicit Scope parameter is now deprecated. Please use JsonQuery.apply(scope, in) instead.
  • Scope(parent) constructor is now deprecated. Please use Scope.newChildScope(parent) instead.
  • Scope() constructor is deprecated (since 0.0.8). Please use Scope.newEmptyScope() instead.

With these deprecations considered, minimal usage becomes a bit lengthy:

// rootScope should be reused as possible because loadFunctions() is a heavy operation.
// After this initial setup, rootScope should not be modified (via setValue(), etc.) so that
// it can be shared across threads.
final Scope rootScope = Scope.newEmptyScope();
rootScope.loadFunctions(Scope.class.getClassLoader());

// If one needs to pass variables to jq, a lightweight child scope should be created per
// apply() invocation or at least per thread.
final Scope childScope = Scope.newChildScope(rootScope);
childScope.setValue("param", IntNode.valueOf(42));

// compile() a query is a relatively heavy operation and the results should be reused as possible.
// q is immutable and thread-safe.
final JsonQuery q = JsonQuery.compile("$param * 2");

// apply() with an explicit scope
q.apply(childScope, in) // => [84]

Bug fixes

  • Default Scope.rootScope() is used inconsistently when calling loadFunctions() on alternative scopes (#17)

jackson-jq 0.0.7

14 Mar 16:39
Compare
Choose a tag to compare

This release contains some incompatible changes. Please take a look at the Incompatible changes between 0.0.6 and 0.0.7 section before upgrading.

New features

More syntax supports

  • [Bug] Field accessors can now follow immediately after closing parentheses (e.g. (.a).b)
  • [jq-1.5] Destructuring syntax (e.g. . as [$a, $b] | $a)
  • [jq-1.5] Generic ? operator (e.g. (.a)?)
  • [jq-1.5] Support try without catch clause (e.g. try .a)
  • [jq-1.5] It's now possible to use reserved keywords as object keys without quotes. (e.g. {if: 10, as: false})

More functions

  • [jq-1.4] recurse_down/0
  • [jq-1.5] combinations/0 and combinations/1
  • [jq-1.5] in/1 and inside/1
  • [jq-1.5] recurse/2
  • [jq-1.5] map_values/1
  • [jq-1.5] infinite/0 and isinfinite/0
  • [jq-1.5] nan/0 and isnan/0
  • [jq-1.5] log2/0 and pow/2
  • [jq-1.x] utf8bytelength/0

Oniguruma regular expressions

The previous versions of jackson-jq had been using Java regular expressions which were often incompatible with jq-1.5's Oniguruma regular expressions. In this release, jackson-jq switched to use joni, an Oniguruma implementation for Java, in order to archive best compatibility with jq. On the other hand, this introduces a compatibility issue with the previous releases of jackson-jq. The following functions are affected:

  • split/2, splits/1 and splits/2 (Note that split/1, a non-regex match version, is not affected)
  • sub/2 and sub/3
  • gsub/2 and gsub/3
  • scan/1 and scan/2
  • capture/1 and capture/2
  • test/1 and test/2
  • match/1 and match/2

Incompatible changes between 0.0.6 and 0.0.7

  • Regular expression functions now uses Oniguruma (see above), this may break some applications.
  • split2/1 (basically split/1 but with regex) is removed because it's never been included in any of the jq releases.
  • Fix contains/1 to raise an error if argument and input types do not match. The previous behavior was to return false.
  • [jq-1.3] length/0 of string now returns the number of Unicode code points, not the number of code units of the UTF-16 representation.
  • [jq-1.5] flatten/1 with a negative depth are not allowed anymore, use flatten/0 instead.
  • [jq-1.5] Division (/) and modulo (%) operators now raise an error if the divisors are zero. The previous behavior was to return +/- infinity.
  • [jq-1.x] join/1 now also accepts an array of non-string values as the input.

Other improvements

  • Built-in functions are now loaded using the ServiceLoader API, which makes it easy to work with maven-shade-plugin.
  • jackson-jq command now accepts --null-input/-n option, which specifies the command to use a single null as the input.