Skip to content

Commit

Permalink
Fix loading field message when dependency is more than one step (#54)
Browse files Browse the repository at this point in the history
Fixes the problem where you would get 
```
compilation error: failed to compile expression api.source_context.file_name: ERROR: <input>:1:4: unexpected failed resolution of 'google.protobuf.SourceContext'
                                 | has(this.source_context.file_name)
                                 | ...^
``` 
for the example added.
  • Loading branch information
oliversun9 authored Sep 29, 2023
1 parent bfb9d45 commit 107ab5c
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 149 deletions.
2 changes: 1 addition & 1 deletion internal/evaluator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (bldr *Builder) processFieldExpressions(
var opts []cel.EnvOption
if fieldDesc.Kind() == protoreflect.MessageKind {
opts = []cel.EnvOption{
cel.TypeDescs(fieldDesc.Message().ParentFile()),
cel.Types(dynamicpb.NewMessage(fieldDesc.Message())),
cel.Variable("this", cel.ObjectType(string(fieldDesc.Message().FullName()))),
}
} else {
Expand Down
Loading

0 comments on commit 107ab5c

Please sign in to comment.