hyperjumptech / grule-rule-engine

Rule engine implementation in Golang
Other
2.22k stars 346 forks source link

Missing JSON fields vs panic #458

Open d-sooter opened 3 months ago

d-sooter commented 3 months ago

I want to use this rules engine to check iot data.

Since the data coming it can be dynamic or even just partial data, i wanted to ask what is the recommended way for handling those rules.

Basically im working with Json data and i dont know if i should add a nil check for all the fields used in the rule as the first part of the rule or if i should let it panic.

Would be great to have a property (something like AllowMissingFacts) the will skip over the rule if one of the values are missing

i guess an alternative is to check all the facts relevant to the rule first, but it seems a bit verbose