Skip to content

Commit 95cf5f6

Browse files
authored
Merge pull request #73 from Advaitva/patch-1
Fix index increment in Signature validation
2 parents cf79ce4 + d7fa65a commit 95cf5f6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/com/dashjoin/jsonata/utils/Signature.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ public Object validate(Object _args, Object context) {
391391
}
392392
}
393393
}
394+
index++;
394395
}
395396
return validatedArgs;
396397
}

src/test/java/com/dashjoin/jsonata/SignatureTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,17 @@ public Object call(Object input, List args) throws Throwable {
5555
}, "<n+:n>"));
5656
Assertions.assertEquals(6, expression.evaluate(null));
5757
}
58+
59+
@Test
60+
public void testVarArgMany(){
61+
Jsonata expr = jsonata("$customArgs('test',[1,2,3,4],3)");
62+
expr.registerFunction("customArgs", new JFunction(new JFunctionCallable() {
63+
64+
@Override
65+
public Object call(Object input, @SuppressWarnings("rawtypes") List args) throws Throwable {
66+
return args.toString();
67+
}
68+
}, "<sa<n>n:s>"));
69+
Assertions.assertEquals("[test, [1, 2, 3, 4], 3]", expr.evaluate(null));
70+
}
5871
}

0 commit comments

Comments
 (0)