Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wnm3 committed Jul 25, 2024
1 parent 9cf16a8 commit fa18172
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 7 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The easiest way to use this library is to include it as a dependency in your Mav
<dependency>
<groupId>com.ibm.jsonata4java</groupId>
<artifactId>JSONata4Java</artifactId>
<version>2.5.0</version>
<version>2.5.1</version>
</dependency>
```

Expand Down Expand Up @@ -53,8 +53,8 @@ Note: to build and deploy the jars to Maven Central you need to use a command li
`mvn clean install deploy -Prelease`

Once you have run the launcher, you can find the jar files in the /target directory. There are two&colon;
* **JSONata4Java-2.5.0-jar-with-dependencies.jar** (thinks includes dependent jar files)
* **JSONata4Java-2.5.0.jar** (only the JSONata4Java code)
* **JSONata4Java-2.5.1-jar-with-dependencies.jar** (thinks includes dependent jar files)
* **JSONata4Java-2.5.1.jar** (only the JSONata4Java code)

The com.api.jsonata4java.Tester program enables you to enter an expression and run it
against the same JSON as is used at the https://try.jsonata.org site. You can also
Expand All @@ -66,6 +66,8 @@ against the same JSON as is used at the https://try.jsonata.org site.


### Fixes ###
Issue 313 fixed a problem with duplicates in the spread function

Issue 167 to add Synced suffixed evaluation methods to allow people running
in a multi-threaded environment to use evaluateSynced, etc. The non-Synced
methods are not thread-safe.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.jsonata4java</groupId>
<artifactId>JSONata4Java</artifactId>
<version>2.5.0</version>
<version>2.5.1</version>
<name>JSONata4Java</name>
<description>Port of jsonata.js to Java to enable rules for JSON content</description>
<url>https://github.com/IBM/JSONata4Java</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,100 @@ public void testArraySeqConstructor() throws Exception {
}
}

@Test
public void testSpreadFunction() throws Exception {
test("$spread($$.array1 ~> $map(function($v1) {\n" +
" $$.array2 ~> $map(function($v2) {\n" +
" $v1 & '#' & $v2\n" +
" })\n" +
" }))", "[\n" +
" \"abcd#pp\",\n" +
" \"abcd#uu\",\n" +
" \"abcd#tt\",\n" +
" \"abcd#uu\",\n" +
" \"abcd#ww\",\n" +
" \"abcd#gg\",\n" +
" \"abcd#qq\",\n" +
" \"abcd#nn\",\n" +
" \"abcd#ff\",\n" +
" \"cdef#pp\",\n" +
" \"cdef#uu\",\n" +
" \"cdef#tt\",\n" +
" \"cdef#uu\",\n" +
" \"cdef#ww\",\n" +
" \"cdef#gg\",\n" +
" \"cdef#qq\",\n" +
" \"cdef#nn\",\n" +
" \"cdef#ff\",\n" +
" \"efgh#pp\",\n" +
" \"efgh#uu\",\n" +
" \"efgh#tt\",\n" +
" \"efgh#uu\",\n" +
" \"efgh#ww\",\n" +
" \"efgh#gg\",\n" +
" \"efgh#qq\",\n" +
" \"efgh#nn\",\n" +
" \"efgh#ff\",\n" +
" \"ghij#pp\",\n" +
" \"ghij#uu\",\n" +
" \"ghij#tt\",\n" +
" \"ghij#uu\",\n" +
" \"ghij#ww\",\n" +
" \"ghij#gg\",\n" +
" \"ghij#qq\",\n" +
" \"ghij#nn\",\n" +
" \"ghij#ff\",\n" +
" \"ijkl#pp\",\n" +
" \"ijkl#uu\",\n" +
" \"ijkl#tt\",\n" +
" \"ijkl#uu\",\n" +
" \"ijkl#ww\",\n" +
" \"ijkl#gg\",\n" +
" \"ijkl#qq\",\n" +
" \"ijkl#nn\",\n" +
" \"ijkl#ff\",\n" +
" \"klmn#pp\",\n" +
" \"klmn#uu\",\n" +
" \"klmn#tt\",\n" +
" \"klmn#uu\",\n" +
" \"klmn#ww\",\n" +
" \"klmn#gg\",\n" +
" \"klmn#qq\",\n" +
" \"klmn#nn\",\n" +
" \"klmn#ff\",\n" +
" \"mnop#pp\",\n" +
" \"mnop#uu\",\n" +
" \"mnop#tt\",\n" +
" \"mnop#uu\",\n" +
" \"mnop#ww\",\n" +
" \"mnop#gg\",\n" +
" \"mnop#qq\",\n" +
" \"mnop#nn\",\n" +
" \"mnop#ff\"\n" +
"]", null, "{\n" +
" \"array1\": [\n" +
" \"abcd\",\n" +
" \"cdef\",\n" +
" \"efgh\",\n" +
" \"ghij\",\n" +
" \"ijkl\",\n" +
" \"klmn\",\n" +
" \"mnop\"\n" +
" ],\n" +
" \"array2\": [\n" +
" \"pp\",\n" +
" \"uu\",\n" +
" \"tt\",\n" +
" \"uu\",\n" +
" \"ww\",\n" +
" \"gg\",\n" +
" \"qq\",\n" +
" \"nn\",\n" +
" \"ff\"\n" +
" ]\n" +
"}");
}

@Test
public void testAppendFunction() throws Exception {

Expand Down
2 changes: 1 addition & 1 deletion tester.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#! /bin/bash
java -cp target/JSONata4Java-2.5.0-jar-with-dependencies.jar com.api.jsonata4java.Tester $1
java -cp target/JSONata4Java-2.5.1-jar-with-dependencies.jar com.api.jsonata4java.Tester $1
2 changes: 1 addition & 1 deletion testerui.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java -cp target/JSONata4Java-2.5.0-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI
java -cp target/JSONata4Java-2.5.1-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI
2 changes: 1 addition & 1 deletion testerui.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#! /bin/bash
java -cp target/JSONata4Java-2.5.0-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI
java -cp target/JSONata4Java-2.5.1-jar-with-dependencies.jar com.api.jsonata4java.testerui.TesterUI

0 comments on commit fa18172

Please sign in to comment.