easy-rules icon indicating copy to clipboard operation
easy-rules copied to clipboard

Allow rules to have optional facts

Open nvervelle opened this issue 2 years ago • 4 comments

The current code prevents executing a rule if one of the facts listed in the parameters of the condition or the action is missing. It would be nice to be able to modify this behavior so that in some situations missing facts do not prevent the execution of the rule if they are specified as being optional.

I will submit a PR in which I take into account the @Nullable annotation on parameters to consider them as optional.

I know that easy-rules is in maintenance mode, so I'm not sure this PR will be reviewed and merger on master... Can you tell me if it's possible or if I should use a forked release for my needs ? Thanks in advance.

nvervelle avatar Jul 25 '22 17:07 nvervelle

I think forking will be the right way to go. I never had such use-case but looks like a good backward compatible change.

I have a fork https://github.com/dvgaba/easy-rules but its upgraded to Java 11/Junit 5.

dvgaba avatar Aug 03 '22 03:08 dvgaba

I think forking will be the right way to go. I never had such use-case but looks like a good backward compatible change.

I have a fork https://github.com/dvgaba/easy-rules but its upgraded to Java 11/Junit 5.

Thanks @dvgaba

If you're interested to include my modification in your own fork, I have no troubles going to Java 11/Junit 5 (my base code is Java 17/Junit 5). Do you want me to submit a PR?

nvervelle avatar Aug 03 '22 05:08 nvervelle

Sure.

dvgaba avatar Aug 03 '22 11:08 dvgaba

Thanks @dvgaba , I've submitted a PR.

nvervelle avatar Aug 05 '22 07:08 nvervelle