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

Allow exe/protoboeuf to function as a protoc plugin #142

Open
tenderworks opened this issue Aug 22, 2024 · 1 comment
Open

Allow exe/protoboeuf to function as a protoc plugin #142

tenderworks opened this issue Aug 22, 2024 · 1 comment

Comments

@tenderworks
Copy link
Contributor

exe/protoboeuf currently works as a stand-alone executable that can read binary protobuf ASTs. I think it would be useful if it was also able to function as a protoc plugin. This way people can integrate our codegen with existing protoc workflows.

@colinbendell
Copy link
Contributor

You will need this if you want to get access to any source-only option fields (For example: https://github.com/Shopify/proto/blob/main/shopify/session/annotations.proto#L13-L16 )

extend google.protobuf.FieldOptions {
  // docs for a session field
  SessionDocs docs = 99901 [retention = RETENTION_SOURCE];
}

These extensions are available in the CodeGeneratorRequest message along with comments. Of course this does mean that you will need to generate and eval both the request and all options at the time of codegen. You can see how we do this in the codegen process for nuevo where we have to load the dependent objects, compile them and then read the options from the descriptor pool

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

No branches or pull requests

2 participants