-
Notifications
You must be signed in to change notification settings - Fork 480
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
fix: improve typing of RuleResult #390
fix: improve typing of RuleResult #390
Conversation
@emilefokkemanavara thanks for putting this up. I'll take a look later today or over the weekend. |
@chris-pardy Thanks for the heads up! |
@emilefokkemanavara This looks great, expect for one issue. The a evaluation of JSON Rules Engine follows these steps:
This means that if a condition doesn't get evaluated it will still be in the rule result but it won't have properties like This set of conditions {
"all": [
{ "fact": "age", "operator": "greaterThanInclusive", "value": 21, "priority": 1 },
{ "fact": "likesOranges", "operator": "equal", "value": true, "priority": 2 }
]
} The result can look like this. {
"all": [
{"fact": "age", "operator": "greaterThanInclusive", "value": 21, "priority": 1, "factResult": 20 },
{ "fact": "likesOranges", "operator": "equal", "value": true, "priority": 2 }
]
} |
@chris-pardy So this means |
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.
Before running the tests could you rebase this and squash the commits to make it a bit easier to read down the line.
Yes, that's correct. |
commit 1356b48 Author: Emile Fokkema <[email protected]> Date: Sun Nov 10 20:08:27 2024 +0100 result and factResult are not always there commit 725fb66 Author: Emile Fokkema <[email protected]> Date: Sat Nov 9 20:07:13 2024 +0100 condition reference can be part of the result commit cb5f3c7 Author: Emile Fokkema <[email protected]> Date: Fri Nov 8 16:27:34 2024 +0000 there are no condition references in the result commit c688692 Author: Emile Fokkema <[email protected]> Date: Fri Nov 8 16:27:09 2024 +0000 begin to add condition result types commit 7a90a81 Author: Emile Fokkema <[email protected]> Date: Fri Nov 8 16:26:42 2024 +0000 add toJSON method to RuleResult
1356b48
to
1d00bef
Compare
re-apply the changes from #390 onto v8
This PR closes #352 by improving the typing of RuleResult.