Closed matthchr closed 2 months ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Hi @matthchr, thanks for the contribution. Would you mind signing the CLA? I'll try to give this a review by the end of the week.
/gcbrun
I've signed the CLA. Let me know if you have any questions as well - I'm happy to talk through our use-case. I had originally done a different approach, something like this:
type NativeFieldAdapter = func(rt reflect.Type, name string) (reflect.StructField, bool)
func defaultNativeFieldAdapter(rt reflect.Type, name string) (reflect.StructField, bool) {
return rt.FieldByName(name)
}
that users could configure, before I realized that actually all I really needed was to be able to configure the tag to parse for the feature that already existed, because what I wanted to do was use JSON tags rather than a new CEL tag.
/gcbrun
/gcbrun
Thanks for merging!
Allowing tags other than "cel" enables more flexibility, particularly when the types in question aren't owned by those configuring the CEL environment.
The main use-case for this is enabling an experience in CEL that matches the shape of an object in JSON (or YAML). This includes:
json:"metadata,omitempty"
is common on Kuberentes resources, allowing users to request CEL use the JSON tags enables access via the ".metadata" property even though there is no such property on the actual Native type.Reviews
Merging
closes #<issue-num>: description
in the merge message, if applicable.