-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NOID] Fixes #2978: The apoc.custom.declareProcedure does not accept default string values #3036
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job 🎉
The reason for originally leaving it out in the parser was that the default signature output doesn't put quotes around strings, which made it too hard to parse for me. |
@jexp Anyway, the pr change the |
@Lojjs we should still adjust the grammar file in core. (And possible also fix the signature output in cypher for strings) |
} | ||
if (v.INT_VALUE() != null) { | ||
final String text = v.INT_VALUE().getText(); | ||
return getDefaultParameterValue(type, text, () -> DefaultParameterValue.ntInteger(Integer.parseInt(text))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. we should fix this as it should be Long.parseLong()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
} | ||
if (v.FLOAT_VALUE() != null) { | ||
final String text = v.FLOAT_VALUE().getText(); | ||
return getDefaultParameterValue(type, text, () -> DefaultParameterValue.ntFloat(Float.parseFloat(text))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this Double.parseDouble()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please addithe bugfix of the old bug that was there before.
I will move it as part of this PR in dev: neo4j/apoc#261. So if you can do your cherry-pick after that goes in, that would be good. Otherwise there is a risk I will write over your changes to the file by moving it |
…s not accept default string values (neo4j-contrib#3036) (neo4j-contrib#3753) * [NOID] Fixes neo4j-contrib#2978: The apoc.custom.declareProcedure does not accept default string values * [NOID] removed unused imports * [NOID] changed parseInt/Float to correct parseLong/Double
Fixes #2978
SIGNATURE_SYNTAX_ERROR
getDefaultParameterValue
to differentiate between plain text and other data typesWith these changes the
apoc.custom.declareFunction/Procedure
should be able to accept any kind of default value, except forfloat
type fixed here.