google / cel-spec

Common Expression Language -- specification and binary representation
https://cel.dev
Apache License 2.0
2.8k stars 223 forks source link

Protobuf extensions #320

Open rodaine opened 11 months ago

rodaine commented 11 months ago

While rare nowadays in general, protobuf extensions are still used to define custom options on descriptors and seem to be one of the first features (re)enabled with editions. The CEL spec doesn't appear to mention one way or another if these fields should be accessible from an expression.

I can see two paths towards supporting proto extensions:

Thoughts?

TristonianJones commented 11 months ago

@rodaine I believe all of the core libraries support protobuf extension accesses; however, we haven't documented this in the spec.

https://github.com/google/cel-go/blob/master/ext/protos.go https://github.com/google/cel-java/blob/main/extensions/src/main/java/dev/cel/extensions/CelProtoExtensions.java https://github.com/google/cel-cpp/blob/master/extensions/proto_ext.h

Hopefully this helps you get started!

rodaine commented 10 months ago

Thanks! @Alfus pointed me toward the cel-go extension functions shortly after I asked (of course 😅). Do you think it's worth documenting that this is to be handled by functions?