Migrate apoc.asFunction to apoc.custom.declareFunction

Hello,

I want to migrate to the new declareFunction as asFunction is deprecated, but I have a hard time defining a custom function with multiple parameters.

The documentation and testcases only contains a single parameter with the name input.
Every other parameter name seem to fail and extra parameters seem to be ignored.

I tried this query:

CALL apoc.custom.declareFunction('foobar(input::NODE, y::NODE) ::(NODE)',
'MATCH (n) RETURN n limit 1');

The declaration looks successful but when looking at the defined function (call apoc.custom.list) it looks like this:

"function"	"foobar"	""	null	"MATCH (n) RETURN n limit 1"	[["input", "node"]]	"node"	false

Any ideas how to solve this?

Cheers,
Ron

Hi @rweverwijk
There seems to be a bug with single character parameters ( y in your case)
In fact, with CALL apoc.custom.declareFunction('foobaz((input::NODE, input2::NODE)) ::(NODE)', 'MATCH (n) RETURN n limit 1');'); the input field is [["input", "node"], ["input2", "node"]].

I created an issue for this one: The procedure apoc.custom.declareFunction does not work correctly with single character parameters · Issue #2032 · neo4j-contrib/neo4j-apoc-procedures · GitHub

Perfect, thanks a lot, I was blindsided by the single character issue!