Closed aeberhart closed 8 months ago
@POST
@Path("/")
@Operation(summary = "evaluates the expression with the data context")
@APIResponse(description = "evaluation result")
@SuppressWarnings({"unchecked", "rawtypes"})
public Object resolve(@Context SecurityContext sc, ExpressionAndData e) throws Exception {
Jsonata expr = Jsonata.jsonata(e.expression);
for (org.dashjoin.function.Function f : ServiceLoader
.load(org.dashjoin.function.Function.class)) {
if (!(f instanceof AbstractConfigurableFunction)) {
((AbstractFunction) f).init(sc, services, this, false);
expr.registerFunction(f.getID(), new JFunction(new JFunctionCallable() {
@Override
public Object call(Object input, List args) throws Throwable {
return f.run(args);
}
}, null));
}
}
return expr.evaluate(e.data);
}
fixed with commit from #272
$classifyEntities(["Apple", "Unicef"], null, 2, 0)
need to call Utils.convertNulls(object)