Work backwards from results to matching input object
How would you recommend fetching the parts of the evaluated object that triggered a match? I want to be able to iterate over the results of a match and then locate the spot in the object graph that caused the match to be true. This is especially relevant in the one to many case. In the results that come out of the engine, how can I find which child caused the result to be 'true'?
Let's say you have a Parent that has many children and the rule matches when any of the children are named Polo. I'd like to be able to sort out which 'children' matched the rule. In the below case, children id 2 and 3 should be matched.
Rule
{
"name": "marco_polo",
"description": "find kids named Polo",
"conditions": {
"any": [
{
"operator": "equal",
"value": "Polo",
"path": "$.Parent.Children[*].Name"
},
]
}
}
Data
{
"Parent": {
"Children": [
{"Id": 1, "Name": "Marco"},
{"Id": 2, "Name": "Polo"}
{"Id": 3, "Name": "Polo"}
]
}
}
Hi, sorry about the delay. Let me take a look at this and I'll respond as best I can.