Skip to content

[kie-issues#1841] Date and time related functions as non literal not permitted #6395

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

Merged
merged 8 commits into from
Jul 17, 2025

Conversation

yesamer
Copy link
Contributor

@yesamer yesamer commented Jul 9, 2025

Closes apache/incubator-kie-issues#1841

According to the DMN 1.6 Specs:

Screenshot 2025-07-09 at 13 46 44

In this PR:

  • In case of Endpoints of FunctionInvocation type, only the functions type are allowed
  • The above function type are allowed as literal only (e.g they can't have functions as parameters)
  • Updated Tests accordingly
  • Allowed node type, values and function are now stored as Set, that is a better fit for this use case.

@yesamer yesamer added the DMN label Jul 9, 2025
@yesamer yesamer requested review from Copilot, gitgabrio and baldimir July 9, 2025 11:56
@yesamer yesamer changed the title kie-issues#1841: Date and time related functions as non literal not permitted [kie-issues#1841]: Date and time related functions as non literal not permitted Jul 9, 2025
@yesamer yesamer changed the title [kie-issues#1841]: Date and time related functions as non literal not permitted [kie-issues#1841] Date and time related functions as non literal not permitted Jul 9, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enforces DMN 1.6 rules for range endpoints by allowing only date/time built‐in functions (without nested calls) or literals, and updates tests accordingly.

  • Introduces isAllowedFunctionInvocationNode to restrict FunctionInvocationNode endpoints
  • Refactors ALLOWED_NODES and ALLOWED_TYPES to use Set and updates RangeFunction logic
  • Revises RangeFunctionTest data and assertions to cover date/time functions and literals

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/RangeFunction.java Adds isAllowedFunctionInvocationNode, switches allowed node/type lists to sets, refactors parsing logic
kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/RangeFunctionTest.java Updates test cases for valid/invalid endpoints, refactors test data arrays
Comments suppressed due to low confidence (1)

kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/functions/RangeFunctionTest.java:565

  • Syntax error: the second string literal is missing a closing parenthesis and quote. It should be "duration(\"P2Y6M\")".
                {"duration(\"P1Y6M\")", "duration(\"P2Y6M\""},

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx - LGTM!

@baldimir baldimir merged commit eba7762 into apache:main Jul 17, 2025
16 of 17 checks passed
@yesamer yesamer deleted the kie-issues#1841 branch July 23, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date and time related functions as non literal not permitted
3 participants