#9458·grpc-go

xds/clients: export TypeURL and Value on AnyProto and remove anypb from resource_type.go

Author: dashpoleCreated Sep 30, 2026Updated Sep 30, 2026

Use case(s) - what problem will this feature solve?

In #8422, AnyProto was introduced in internal/xds/clients/xdsclient/resource_type.go with exported TypeURL string and Value []byte fields so that the exported xdsclient API surface had zero google.golang.org/protobuf imports.

Later, #8640 imported google.golang.org/protobuf/types/known/anypb into resource_type.go, added NewAnyProto(*anypb.Any) and ToAny() *anypb.Any, and unexported typeURL and value. As a result, resource_type.go currently exposes *anypb.Any in its public API surface while still requiring callers and decoders to wrap and unwrap *AnyProto on every decode.

Proposed Solution

Restore the zero-protobuf boundary from #8422 in resource_type.go:

  1. Re-export TypeURL string and Value []byte on AnyProto:
    go
    type AnyProto struct {
        TypeURL string
        Value   []byte
    }
  2. Remove NewAnyProto(*anypb.Any), ToAny() *anypb.Any, and the google.golang.org/protobuf/types/known/anypb import from resource_type.go.

Alternatives Considered

Passing *anypb.Any directly to Decoder.Decode and deleting AnyProto. This was rejected to avoid exposing direct protobuf dependencies in the public API surface.

Additional Context

Part of #9455.