Closed eddycharly closed 4 weeks ago
The implementation depends on support for registering protobuf types,
but it doesn't strictly require the provider must be types.Registry
.
If the CustomTypeProvider
implements the following methods, then
this option will still work:
// customTypeRegistry is an internal-only interface containing the minimum methods
// required to support custom types. It is a subset of methods from ref.TypeRegistry.
type customTypeRegistry interface {
RegisterDescriptor(protoreflect.FileDescriptor) error
RegisterType(...ref.Type) error
}
In terms of order of operations, you'd do the following:
cel.NewEnv(
cel.CustomTypeProvider(<your-provider-here>),
cel.Types(<your-types-here>),
)
Thanks but i still don't get why it must be specified after the CustomTypeProvider.
Is this supposed to be invalid ?
cel.NewEnv(
cel.Types(<your-types-here>),
cel.CustomTypeProvider(<your-provider-here>),
)
From the comment in
cel.Types
env option:But the implementation assumes the provider is a
types.Registry
. How can this happen after theCustomTypeProvider
option ?What am i missing here ?