Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support google.api attributes/conventions #1019

Open
jenia opened this issue Mar 23, 2024 · 1 comment
Open

Support google.api attributes/conventions #1019

jenia opened this issue Mar 23, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jenia
Copy link

jenia commented Mar 23, 2024

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?

@stephenh stephenh changed the title How to use [(google.api.field_behavior) = OPTIONAL] Support google.api attributes/conventions Mar 24, 2024
@stephenh
Copy link
Owner

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!

@stephenh stephenh added enhancement New feature or request help wanted Extra attention is needed labels Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants