ts-proto
ts-proto copied to clipboard
Support `google.api` attributes/conventions
Hello.
I want to use google.api.field_behavior as so:
import "proto/googleapis/google/api/field_behavior.proto";
message PersonRequest {
string query = 1 [(google.api.field_behavior) = REQUIRED];
int32 page_number = 2;
int32 results_per_page = 3;
string name3 = 4 [(google.api.field_behavior) = OPTIONAL];
}
But instead of compiling name3 to name3?: string I see:
export interface PersonRequest {
query: string;
pageNumber: number;
resultsPerPage: number;
name3: string;
}
Here is how I compile the protocol buffer:
protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto \
-I. \
--ts_proto_out=./src \
./proto/person.proto
Anyone knows how to use google.api.field_behavior with ts_proto?
Hi @jenia ; ts-proto doesn't currently support the various google.api-* attributes. Afaiu they are not really a part of core protobuf behavior, and instead a set of conventions that google-specific services (or google-style APIs) have adopted.
It is fairly unlikely we'll support this, unless a contributor steps up to flush it out & own this functionality long-term. If you're interested, that'd be great! Thanks!