-
-
Notifications
You must be signed in to change notification settings - Fork 481
Open
Description
I'm handling a dynamic env, which is represented by a map[string]any.
When using expr.Env, it only enforces the strict mode to the immediate map, but not any nested maps.
I want to enforce that any path or reference to this dynamic environment is accessible and valid, pretty much like a strict validation.
- Only allow accessing existing variables and their nested attributes, erroring otherwise, like in the existing expr.Env behavior
- Only allow accessing slice indexes that are given in the expr.Env or any nested attribute
Example:
// This compiles without error, but should error:
_, err := expr.Compile(`var1.attr2`,
expr.Env(map[string]any{
"var1": map[string]any{
"attr1": 1,
},
}),
)
require.Error(t, err)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels