Skip to content

Commit

Permalink
update jsonata / jsonata4j #272
Browse files Browse the repository at this point in the history
  • Loading branch information
aeberhart committed Oct 30, 2023
1 parent 9b4c384 commit 25a5878
Show file tree
Hide file tree
Showing 7 changed files with 395 additions and 444 deletions.
2 changes: 1 addition & 1 deletion dashjoin-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>com.dashjoin</groupId>
<artifactId>jsonata</artifactId>
<version>0.9.1</version>
<version>0.9.3</version>
</dependency>

<!-- dev dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.dashjoin.expression.ExpressionService.ExpressionAndData;
import org.dashjoin.mapping.ETL;
import org.dashjoin.service.Services;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
Expand All @@ -12,12 +17,6 @@
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.SecurityContext;
import org.dashjoin.expression.ExpressionService.ExpressionAndData;
import org.dashjoin.mapping.ETL;
import org.dashjoin.service.Services;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
import com.fasterxml.jackson.databind.JsonNode;

/**
* REST API for expression evaluation in read only mode
Expand Down Expand Up @@ -49,7 +48,7 @@ public Object resolve(@Context SecurityContext sc, ExpressionCursorData e) throw
if (e.foreach) {
try {
ETL.context.set(new org.dashjoin.mapping.ETL.Context());
JsonNode node = expression.jsonata(sc, e.expression, ExpressionService.o2j(e.data), true);
Object node = expression.jsonata(sc, e.expression, (e.data), true);
ETL.context.get().producerDone();
if (ETL.context.get().queue.size() > 10) {
List<Object> res = new ArrayList<>();
Expand All @@ -59,7 +58,7 @@ public Object resolve(@Context SecurityContext sc, ExpressionCursorData e) throw
return res;
} else if (ETL.context.get().queue.isEmpty()) {
// no queue, use result directly
Object o = ExpressionService.j2o(node);
Object o = (node);
@SuppressWarnings("unchecked")
List<Object> list =
o == null ? Arrays.asList() : o instanceof List ? (List<Object>) o : Arrays.asList(o);
Expand All @@ -73,6 +72,6 @@ public Object resolve(@Context SecurityContext sc, ExpressionCursorData e) throw
ETL.context.set(null);
}
} else
return expression.jsonata(sc, e.expression, ExpressionService.o2j(e.data), true);
return expression.jsonata(sc, e.expression, (e.data), true);
}
}
Loading

0 comments on commit 25a5878

Please sign in to comment.