Closed raunakkathuria closed 2 months ago
The decision is compiling fine on gorules. Refer https://github.com/gorules/zen/issues/164
I encountered a similar issue.
I resolved my problem by switching method from engine.Evaluate
to the engine.EvaluateWithOpts
and manually setting EvaluationOptions.MaxDepth
to 2.
By the way, I believe this is a bug.
In my opinion, the reason for this bug might be: In the code, the implementation of the engine.Evaluate
method calls engine.EvaluateWithOpts
, and passes EvaluationOptions
, but does not explicitly specify the value of EvaluationOptions.MaxDepth
, so the default value is set to 0, thus limiting the reference level during the execution of decision.
Thanks @StewartHuang. It worked. Here is the diff for reference if anyone stumble on the same
- response, err := engine.Evaluate("signup/graph.json", map[string]any{"residence": "es", "account": "real"})
+ response, err := engine.EvaluateWithOpts("signup/graph.json", map[string]any{"residence": "es", "account": "real"}, zen.EvaluationOptions{
+ Trace: true,
+ MaxDepth: 2,
+ })
+
Refer commit
Looks like different methods with different syntax. Evaluate
process with no options, EvaluateWithOpts
expects these options. I will close the issue as this needs to be better documented and not a functionality issue
Problem
I am getting the following error when using the decision node from another file
Steps to reproduce
git clone git@github.com:raunakkathuria/gorules-zen-go-test.git
(https://github.com/raunakkathuria/gorules-zen-go-test)cd gorules-zen-go-test
go run main.go