Hello! I’m getting some validation errors when try...
# help
a
Hello! I’m getting some validation errors when trying to add a policy using
cerbos-sdk-go@v0.2.15
and I’m not sure if I’m doing something wrong or is there a bug in the SDK. I’ll add the code and the error bellow:
Copy code
// Code
rule := cerbos.NewAllowResourceRule("createUser")
err := rule.Validate()
if err != nil {
  panic(fmt.Sprintf("failed to create allow resource rule: %v", err))
}
Copy code
// Error
"failed to create allow resource rule: compilation error: failed to compile standard constraint \"<http://buf.validate.EnumRules.in|buf.validate.EnumRules.in>\": compilation error: failed to compile expression <http://enum.in|enum.in>: ERROR: <input>:1:19: undeclared reference to 'getField' (in container '')\n | !(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''\n | ..................^\nERROR: <input>:1:79: undeclared reference to 'getField' (in container '')\n | !(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''\n | ..............................................................................^"
d
Hi Alexandru, I’m unable to reproduce it. Can you run
go mod tidy
and try again? The
v0.2.15
SDK version is rather old. Can you update to the latest one?