Skip to content

Commit

Permalink
add time.proto to message argument's public dependency (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy authored Aug 21, 2024
1 parent 2ba7058 commit 7d9ad60
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4008,23 +4008,32 @@ func (r *Resolver) fromCELType(ctx *context, typ *cel.Type) (*Type, error) {

const (
privateProtoFile = "grpc/federation/private.proto"
timeProtoFile = "grpc/federation/time.proto"
durationProtoFile = "google/protobuf/duration.proto"
)

func messageArgumentFileDescriptor(arg *Message) *descriptorpb.FileDescriptorProto {
desc := arg.File.Desc
msg := messageToDescriptor(arg)
var importedPrivateFile bool
var (
importedPrivateFile bool
importedTimeFile bool
)
for _, dep := range desc.GetDependency() {
if dep == privateProtoFile {
switch dep {
case privateProtoFile:
importedPrivateFile = true
break
case timeProtoFile:
importedTimeFile = true
}
}
deps := append(desc.GetDependency(), arg.File.Name)
if !importedPrivateFile {
deps = append(deps, privateProtoFile)
}
if !importedTimeFile {
deps = append(deps, timeProtoFile)
}
return &descriptorpb.FileDescriptorProto{
Name: proto.String(arg.Name),
Package: proto.String(federation.PrivatePackageName),
Expand Down

0 comments on commit 7d9ad60

Please sign in to comment.