googleapis / googleapis/cloud-bigtable-cbt-cli

Unpacking `proto.Any`

Open
#169 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
Go
Stars
15
Forks
42
PR merge metrics
No merged PRs in 30d

Description

**Describe the solution you'd like**

I'd like properties of type `proto.Any` to be recursively unpacked when formatting the cell values serialized in protobuf.

For example, I have the a cell value serialized using the following schema:

```proto
import "google/protobuf/any.proto";
message Foo {
string id = 1;
google.protobuf.Any bar = 2;
}

message Bar {
string baz = 1;
}
```

When writing to Bigtable I set the value of `bar` with [Any.pack](https://protobuf.dev/reference/java/api-docs/com/google/protobuf/Any.html#pack-T-) on an instance of `Bar`. Then I try to inspect the content of the cell. I have all the proto files included in the `format-file` .

At the moment I get:

```yaml
id: "123"
bar:
type_url: "type.googleapis.com/Bar" value: "..."
```

I'd like cbt to [unpack](https://protobuf.dev/reference/java/api-docs/com/google/protobuf/Any.html#unpack-java.lang.Class-) the value to the type specified under "type_url"

**Additional context**
For comparison, `grpcurl` is able to identify and unpack `proto.Any` as long as the type is one of the files added with `-import-path` and `-proto`: [source?](https://github.com/fullstorydev/grpcurl/blob/7ccaf0a21fedf97d7dd429cd75f00bc0a15a882b/format.go#L43)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.