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

Use server reflection as a valid input for proto files #3171

Closed
ahmednfwela opened this issue Jul 18, 2024 · 3 comments
Closed

Use server reflection as a valid input for proto files #3171

ahmednfwela opened this issue Jul 18, 2024 · 3 comments
Labels
Feature New feature or request

Comments

@ahmednfwela
Copy link

Feature

The reflection protocol (defined here) can be used to retrieve all available services hosted on a grpc server.

using this rpc it's possible to invert the returned proto descriptors back into their original .proto file format (grpcurl just did this recently).

Thus making it possible to use as input in buf cli, mainly buf generate

@ahmednfwela ahmednfwela added the Feature New feature or request label Jul 18, 2024
@ahmednfwela ahmednfwela changed the title Use server reflection address as a valid input for proto files Use server reflection as a valid input for proto files Jul 18, 2024
@doriable
Copy link
Member

Thanks for filing this issue! From our perspective, the descriptors returned from reflection does not contain information such as SourceCodeInfo, etc. and would be unstable to support it as a first class input in the buf CLI.

That being said, the Proto descriptors and subsequently the Protobuf definitions inferred/generated from grpcurl can be used as inputs already to buf generate, assuming you have a buf.gen.yaml:

$ grpcurl -plaintext -proto-out-dir "out_protos" "localhost:8787" describe my.custom.server.Service
$ buf generate out_protos

@ahmednfwela
Copy link
Author

@doriable what i am suggesting is inlining what grpcurl does into buf cli, as this will greatly simplify developer experience by not having to maintain 2 binaries just to generate protos

if you are accepting contributions I can create a PR

@doriable
Copy link
Member

I have understood the original request and apologies, I should've elaborated more in my previous response. The inputs key in buf.gen.yaml maps directly to all the input types supported across the buf. So in order to support this feature request, we would either need to break this mental model, which is not a product/design decision we are able to make at this time, or we would need to add support for it as an input as a whole. And as mentioned, after discussing this issue with the team internally, we came to the conclusion that the descriptors from the server reflection Protocol is not viable to support as a first-class input type.

That being said, we can explore supporting similar features for interacting with the reflection protocol through buf curl to output descriptors, which would help reduce the maintenance overhead for binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants