j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.83k stars 1.04k forks source link

Allow rules to have optional facts #390

Open nvervelle opened 1 year ago

nvervelle commented 1 year ago

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.

dvgaba commented 1 year ago

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.

nvervelle commented 1 year ago

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?

dvgaba commented 1 year ago

Sure.

nvervelle commented 1 year ago

Thanks @dvgaba , I've submitted a PR.