Alexandru Dragomir
06/09/2025, 7:04 PMcerbos-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:
// Code
rule := cerbos.NewAllowResourceRule("createUser")
err := rule.Validate()
if err != nil {
panic(fmt.Sprintf("failed to create allow resource rule: %v", err))
}
// 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 | ..............................................................................^"
Dennis (Cerbos)
go mod tidy
and try again?
The v0.2.15
SDK version is rather old. Can you update to the latest one?