Change
Summary of the proposed change and some details about what problem
it helps solve.
The ext.NativeTypes constructor only adds types directly passed to it but not subtypes within those types. This means that sub-fields that are part of a different type can not be accessed. I found this surprising and ended up having to write some reflect code to get my type including all its nested types added. I would think that this is a relatively common usecase, so IMHO having the ability to this directly in cel-go would be helpful.
Example
type MyType struct {
SomeField Bar
}
type Bar struct {
First string
}
When adding MyType using ext.NativeTypes, trying to access MyType.SomeField.First in a CEL expression will fail.
Alternatives considered
Briefly list alternative designs, or an example of the functionality to be replaced.
- Not doing this in
ext.NativeTypes but a new constructor like ext.NativeTypesRecursive or such
- Telling users to do this through
reflect themselves
Change
Summary of the proposed change and some details about what problem
it helps solve.
The
ext.NativeTypesconstructor only adds types directly passed to it but not subtypes within those types. This means that sub-fields that are part of a different type can not be accessed. I found this surprising and ended up having to write some reflect code to get my type including all its nested types added. I would think that this is a relatively common usecase, so IMHO having the ability to this directly in cel-go would be helpful.Example
When adding
MyTypeusingext.NativeTypes, trying to accessMyType.SomeField.Firstin a CEL expression will fail.Alternatives considered
Briefly list alternative designs, or an example of the functionality to be replaced.
ext.NativeTypesbut a new constructor likeext.NativeTypesRecursiveor suchreflectthemselves